如何使用XSD和NO WSDL调用Java中的Web服务? [英] How do you call a web service in Java with only XSD and NO WSDL?

查看:208
本文介绍了如何使用XSD和NO WSDL调用Java中的Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司外部有一个Web服务,它不为其服务提供WSDL。他们提供:

I have a web service outside of my company that provides no WSDL for their service. They do provide:


  • 有关如何 POST 到他们的服务

  • SoapEnvelope 应该是什么样的

  • 甚至是 .xsd 我可以使用它来创建要放入SOAP的消息< env:Body>< / env:Body>

  • a detailed document on how to POST to their service
  • what a SoapEnvelope should look like
  • and even an .xsd that I can use to create the message to put in the SOAP <env:Body></env:Body> of the call.

如何在没有WSDL的情况下对Web服务进行SOAP调用(在Java)?我需要一个可以获取JAXB格式的XML消息的工具,将其包装在SOAP Envelope中,并将其作为HTTP POST发送到某些Web服务(使用SSL和证书)。

How do you make a SOAP call to a web service without a WSDL (in Java)? I need a tool that can take my JAXB-formatted XML message, wrap it in a SOAP Envelope, and send it as HTTP POST to some web service (with SSL and Certificates).

是否有工具可以轻松实现这一目标?我用 CXF 简要介绍jax-ws-dispatch-api.htmlrel =nofollow> JAX-WS调度,但由于大多数示例和文档都需要 wsdl 文档,我不确定CXF是否应该是我应该使用的。

Are there tools that make this easy? I've looked at CXF with JAX-WS dispatch briefly, but since most examples and documentation expect a wsdl document, I am not sure if CXF is what I should be using.

推荐答案

他们是否提供了URL?尝试浏览 http:// the-url-of-service-那个 - 不提供 - wsdl / wsdl

Did they give you the URL? Try to surf to http://the-url-of-service-that-does-not-provide-wsdl/wsdl

这是你应该下载WSDL文件的标准URL(除非他们手工编码所有东西)。

this is the standard URL where you should download the WSDL file (unless they coded everything by hand).

好的,如果没有,你有两种方式

OK, if not you have 2 ways


  1. 创建WSDL自己基于他们的文档。

  1. Create the WSDL yourself based on their document.

使用您知道的任何工具解析SOAP XML。例如JAXB,Digester,DOM

Parse the SOAP XML using any tool you know. For example JAXB, Digester, DOM

这篇关于如何使用XSD和NO WSDL调用Java中的Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆