简体   繁体   English

WSDL的JAX-WS端口

[英]JAX-WS port from WSDL

I have a JAX-WS imported WSDL client. 我有一个JAX-WS导入的WSDL客户端。 When I try to connect to webservice endpoint, the JAX-WS client tries to load WSDL. 当我尝试连接到webservice端点时,JAX-WS客户端尝试加载WSDL。 Why that? 为什么?

  • I don't want to store the WSDL in my project, 我不想将WSDL 存储在我的项目中,
  • I don't want to load WSDL from webservice URL again? 我不想再次从webservice URL 加载 WSDL?

Questions : 问题

  • Is there a chance to bypass this behavior? 有没有机会绕过这种行为?
  • How to add webservice endpoint URL at runtime? 如何在运行时添加webservice端点URL?

Adding port with the same QName and port name fails, because I cant add the same. 添加具有相同QName和端口名称的端口失败,因为我无法添加相同的内容。 Adding a different port is OK, but I cant get it from the webservice delegate, because the WSDL does not contains the added port definition. 添加一个不同的端口是可以的,但是我无法从webservice委托中获取它,因为WSDL不包含添加的端口定义。

JAX-WS seem to be completely wrong way :( JAX-WS似乎是完全错误的方式:(

Today you're in luck. 今天你很幸运。 There is a way, as you've mentioned. 正如你所提到的,有一种方法。

QName qname = new QName("http://thenamespace", "FooService");
FooService service = new FooService(null, qname); // null for ignore WSDL file
Foo port = service.getFooPort();
BindingProvider bindingProvider = (BindingProvider) port;
bindingProvider.getRequestContext()
    .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
    "http://foo.com/soap/fooBean");

// Use the service
Object obj = port.doSomething(param);

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

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