JAXWS — how to change the endpoint address [duplicate]

You can achieve that using the BindingProvider interface. JAX-WS custom endpoint /** * The following snippets shows how to set a custom endpoint for a JAX-WS generated WebClient on runtime */ // Get the service and the port SampleService service = new SampleService(); Sample port = service.getESamplePort(); // Use the BindingProvider’s context to set the … Read more

overriding or setting web service endpoint at runtime for code generated with wsimport

Your client can set the end-point in the service “port” at runtime via the BindingProvider interface. Consider the JAX-WS client in this JAX-WS tutorial. Another way to write this code would be: HelloService service = new HelloService(); Hello port = service.getHelloPort(); BindingProvider bindingProvider = (BindingProvider) port; bindingProvider.getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, “http://foo:8086/HelloWhatever”); String response = port.sayHello(name); Caveat: I … Read more

What’s the difference between and in WSDL?

portType (Analogs to Java interface) PortType is an abstraction part of WSDL. An abstract set of operations supported by one or more endpoints. binding Binding is an concrete part of WSDL. Describes how the operation is invoked by specifying concrete protocol and data format specifications for the operations and messages. bindings are three types SOAP … Read more

java: Rpc/encoded wsdls are not supported in JAXWS 2.0

RPC/encoded is a vestige from before SOAP objects were defined with XML Schema. It’s not widely supported anymore. You will need to generate the stubs using Apache Axis 1.0, which is from the same era. java org.apache.axis.wsdl.WSDL2Java http://someurl?WSDL You will need the following jars or equivalents in the -cp classpath param: axis-1.4.jar commons-logging-1.1.ja commons-discovery-0.2.jar jaxrpc-1.1.jar … Read more

How to programmatically set the SSLContext of a JAX-WS client?

This one was a hard nut to crack, so for the record: To solve this, it required a custom KeyManager and a SSLSocketFactory that uses this custom KeyManager to access the separated KeyStore. I found the base code for this KeyStore and SSLFactory on this excellent blog entry: how-to-dynamically-select-a-certificate-alias-when-invoking-web-services Then, the specialized SSLSocketFactory needs to … Read more