简体   繁体   中英

JAX-WS port from WSDL

I have a JAX-WS imported WSDL client. When I try to connect to webservice endpoint, the JAX-WS client tries to load WSDL. Why that?

  • I don't want to store the WSDL in my project,
  • I don't want to load WSDL from webservice URL again?

Questions :

  • Is there a chance to bypass this behavior?
  • How to add webservice endpoint URL at runtime?

Adding port with the same QName and port name fails, because I cant add the same. 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.

JAX-WS seem to be completely wrong way :(

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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