简体   繁体   English

使用不带WSDL的Java的肥皂客户端服务-如何?

[英]Soap client service using java without WSDL - How to?

I use JAX-WS thats ships with jdk to create soap client. 我使用jdk附带的JAX-WS来创建soap客户端。 Now, the service provider isn't exposing the wsdl. 现在,服务提供商没有公开wsdl。 How to create soap client without wsdl, if I know the provided services? 如果我知道提供的服务,如何在没有wsdl的情况下创建soap客户端?

Edit: I have the freedom to use any soap api/tool, not restricted to JAX-WS. 编辑:我可以自由使用任何肥皂api /工具,而不仅限于JAX-WS。

Edit2: Here is the message that is shown when the service url is hit. Edit2:这是单击服务URL时显示的消息。 Metadata publishing for this service is currently disabled. 当前禁用了此服务的元数据发布。 And suggests to configure service behavior configuration. 并建议配置服务行为配置。 I understand the service is done in .Net. 我了解该服务是在.Net中完成的。 But How do I use the provided service behavior related details to access the service in Java? 但是,如何使用提供的与服务行为相关的详细信息来访问Java中的服务?

You can use HttpClient directly but you must hand-code each xml message you send and parse each message you receive. 您可以直接使用HttpClient,但是必须手动编码发送的每个xml消息并解析收到的每个消息。 You can also manually create your objects that match your xml and use jaxb to marshall/unmarshall messages. 您还可以手动创建与xml匹配的对象,并使用jaxb编组/解组消息。

You can create a client service provider which extends javax.xml.ws.Service , and then override service constructor accepting URL of the remote service you currently have at hand. 您可以创建一个扩展javax.xml.ws.Service的客户端服务提供程序,然后重写服务构造函数,以接受您当前拥有的远程服务的URL。

public class Foo extends Service
{ 
  ... 

  public Foo(URL wsdlLocation)
  {
    super(wsdlLocation, SERVICE);
  }
}

And then when building your Provider Binding, you explicitly pass the URL to the service interface. 然后,在构建提供者绑定时,您将URL明确传递给服务接口。

Foo service = new Foo(url);
BindingProvider binding = (BindingProvider)service;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM