CXF JAXWS Client Returning Null

We’re using CXF to generate both our web service and client. For a certain method call, the web service was returning the correct XML (we used tcpmon to make sure of this), but the CXF client was returning null to our code, instead of the returned objects. Other web service methods were returning data correctly, however.

After some research we discovered a difference between the WSDLs for the two method calls. Here’s the correct one:

<xsd:complexType name=”getAllCategoriesResponse”>
<xsd:sequence>
<xsd:element minOccurs=”0″ name=”return” nillable=”true” type=”ns1:ArrayOfCategory”></xsd:element>
</xsd:sequence>
</xsd:complexType>

And here’s the incorrect one:

<xsd:complexType name=”loginResponse”>
<xsd:sequence>
<xsd:element minOccurs=”0″ name=”User” nillable=”true” type=”ns1:User”></xsd:element>
</xsd:sequence>
</xsd:complexType>

Note that the correct xsd:element has a name of “return,” but the incorrect one has a name of “User.” For some reason, the CXF client ignores returned data unless its name is “return”. When we switched “User” to “return,” it worked fine.

If any readers have details on why this is the case, or other light to shed on the issue, please comment. Thanks!

About these ads

2 Responses to CXF JAXWS Client Returning Null

  1. Thank you so much!
    I’m using Spring to create a JaxWS client proxy from annotated Jaca interface and my method call returned null. After reading your post, I removed the @WebResult annotation from interface and bang, it worked!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 525 other followers

%d bloggers like this: