Search code examples
jax-wsmarshallingunmarshallingstub

Do we need to generate stubs while writing a JAX WS client


While we write a EJB client we need to generate EJB stub classes based on the EJB Remote interface. These stub classes are resposible to serialize/deserialize the object parameters and return values.

When we use a JAX WS client, do we still need to generate stub classes to marshall and unmarshall Java <--> XML?

Or will it be done by the Websphere JAX WS implementation classes somehow automatically under the hood?


Solution

  • If you mean that you need something extra to convert the XML message (SOAP message) to Java object and viceversa, you don't.

    JAX-WS converts the incoming SOAP message (actually a XML request) to Java object. And transforms the Java objects to XML response for send to the web service client.

    SOAP Message
    (source: anyframejava.org)

    The conversion in both directions is performed by JAXB.

    See more in Developing Web Services Applications.