Question

I have an Java Web Application for which we build an EAR and deploy in Websphere 6. For the first time we are trying to consume a Web Service. (We only need to consume the Web Service, the WSDL path and the WSDL is shared with us) I have tested the Web Service by using the WSDL provided and getting the clients generated with Eclipse.

I need to know how do I integrate this independent module into my existing, thus everything will go as a single EAR (the existing code + this new clients for the WebService)

Do I need to keep the WSDL as the part of my code as well ?

Was it helpful?

Solution

The WSDL would generally be bundled in your application. For a container-managed web service client in a WAR you might:

  • place the WSDL and and dependent schemas under WEB-INF
  • add a service-ref element to the web.xml
  • load the client code using a JNDI InitialContext and the service-ref-name

There are some examples in this IBM jax-ws documentation.

On current Java EE versions you might make more use of annotations. It depends on the platform you're targeting and what versions of the web service APIs it supports. I would start with the Java EE tutorial.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top