Asdfasf

Wednesday, October 03, 2012

Shipping WSDL with Jar for JAX-WS Client

If you work with JAX-WS for webservice client, jax-ws needs wsdl file on runtime. For this purpose, it is better to ship wsdl file with your client code in jar file. Just put wsdl file at top level directory in jar file as below:
-JAR
----META-INF/
----wsdl/service.wsdl

Then, you can instantiate client port as below


 URL wsdlLocation = MyClass.class.getResource("/wsdl/service.wsdl");  
 MyService service = new MyService(wsdlLocation);  
 MyPort proxy = service.getBasicHttpBindingPort();  
 ((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceEndPointUrl);  

.

No comments: