views:

1876

answers:

3

hi!

I'm consuming an axis 1.4 web service that returns soap responses that I want to unmarshal into my domain objects using jaxb annotations. My initial tests worked very well until some of the returned messages had multiRef elements. Objects that were marshalled using multiRef were showing up as null in my client side annotated model objects.

My question is does JAXB support unmarshalling soap responses with multiRef elements? If so, how? and if not, does anybody know of a better way to unmarshal axis 1.4 soap responses into my domain model in java?

Thank you much for any help!

+1  A: 

In case of web services JAXB doesn't come alone, but as data binding part of ws client framework. So I assume your question is how to use JAXB as data binding within axis 1.4. In general I think there is no easy way to achieve that, have a look at the following thread in axis-user mailing list: Specify JAXB generated complex types to Axis web service.

If you can upgrade to consume web service with axis2 then it should be much easier since axis2 comes with pluggable data binding architecture including integrated jaxb implementation.

Gennady Shumakher
A: 

If the Axis side of the web service is also under you control then maybe you can set the property org.apache.axis.AxisEngine.PROP_DOMULTIREFS to false. In that case Axis shouldn't create multiRef elements. I've used this property on client side Axis, hopefully it works on server side the same way.

martsraits
A: 

if you are dealing with MultiREFs , then you are probably consuming an RPC service. JAXB is suitable for Document style webservices.

In order to consume an RPC style service, do not use any external binding like JAXB, JIBX or

use plain JAX-RPC , wsdl2java Ant task is available to generate the stubs, and specify nobinding option.