Search code examples
soapwsdlcode-generationapache-axis

Generating Java classes from WSDL with complex types using Axis2


I have a web service built in .NET (2.0 I believe), and the WSDL for it was auto-generated by the framework. I'm trying to build a Java client to it, and using Axis2's wsdl2java to generate the stub classes with the ADB databinding (primarily because the lead partner for this client has been doing the same thing for services written in Java).

The WSDL contains a number of complex types that look like this...snippet:

<s:sequence>
  <s:element minOccurs="1" maxOccurs="1" name="ID" type="s:long" /> 
  <s:element minOccurs="0" maxOccurs="1" name="PRODUCT_NAME">
   <s:complexType mixed="true">
    <s:sequence>
     <s:any /> 
    </s:sequence>
   </s:complexType>
  </s:element>
   ...

In the SOAP messages, those fields would all have CDATA tags--

<PRODUCT_NAME><![CDATA[test]]></PRODUCT_NAME>

When wsdl2java generates the code to consume this service, these fields are defined as being of types like PRODUCT_NAME_type0, and they expect to find PRODUCT_NAME_type0 as a tag in the SOAP response. Having it the Java code is a bummer, but expecting it to be in the SOAP response is causing errors. Is there a flag for wsdl2java that would change this behavior? Do I have to use a different binding? Different tool?


Solution

  • Wow, I thought this would have been an easy question for someone out there...

    I ended up deciding that ADB was probably not designed to support the WSDL I had, and switched to using the wsimport utility from JAX-WS, which appears to be working.