CXF JAXWS Client Returning Null

June 30, 2009

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!

Advertisements