axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Perry2 <PERR...@uk.ibm.com>
Subject WSDL2Ws does not not always use WSDL element names in generated stubs
Date Tue, 15 Mar 2005 12:25:17 GMT
Apologies for send a note, but Jira is down at the moment.

I have created a WSDL to test nested complex types with arrays of complex
types which also contain simple arrays as well as other data elements.

The WSDL definition of one of the complex types is

---------------------------------------------
   <complexType name="ComplexType1">
    <sequence>
     <element name="simpleArrays" nillable="true"
type="impl:SimpleArrays"/>
     <element name="string" nillable="true" type="xsd:string"/>
     <element name="int" type="xsd:int"/>
    </sequence>
   </complexType>
---------------------------------------------

The generated stubs for one of the nested complex types has named the
elements as follows:

public:
    SimpleArrays* simpleArrays;
    xsd__string _string;
    xsd__int _int;

In the WSDL the element names are reserved words in the 'C/C++' language so
the '_' is put in the element name. Unfortunately it was also using this
name in the Axis_Serialize_xxx method for serializing the elements,
pSZ->serializeAsElement("_string", Axis_URI_ComplexType1,
(void*)(param->str_string), XSD_STRING); rather than the name of the
element from the WSDL which is just "string" and "int" without the '_'.
This causes an Internal Server Error as the element names do not match the
name in the WSDL so the server doesn't know what to do.

---------- formatted for clarity ----------

HTTP/1.1 500 Internal Server Error
Server: WebSphere Application Server/5.1
Content-Type: text/xml; charset=utf-8
Content-Language: en-US
Transfer-Encoding: chunked

2ec
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode xmlns="">Server.generalException</faultcode>
      <faultstring xmlns="">
       <![CDATA[org.xml.sax.SAXException: WSWS3047E: Error: Cannot
deserialize element _string of bean
org.apache.test.nestedcomplex.ComplexType1. To see the message containing
the parsing error in the log, either enable web service engine tracing or
set MessageContext.setHighFidelity(true).]]>
      </faultstring>
      <detail xmlns=""/>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>
0
---------------------------------------------

By manually editing the generated stubs to use the correct element name
from the WSDL the test works.


Attached WSDL. (See attached file: NestedComplex.wsdl)


Also changing the names in the WSDL will solve it, but that's not the
point.

Regards,

Andrew Perry
IBM Web Services Client for C/C++
perryan@uk.ibm.com
Mail Point 127
IBM UK Laboratories. Hursley Park, Winchester, Hants. SO21 2JN
Tel. Internal 249828  External + 44 (0)1962 819828
Fax. + 44(0)1962 818080
Mime
View raw message