Uploaded image for project: 'Axis-C++'
  1. Axis-C++
  2. AXISCPP-980

C++ stub generation problem with array of xsd types inside a complexType

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 1.6 Beta
    • current (nightly)
    • Client - Stub
    • None

    Description

      Hi,

      I'm having a problem where Axis C++ is generating stub code
      that does not compile. After trimming the WSDL file down a bit,
      I've narrowed it down to the case where a complexType has
      a field which is an array of xsd types, e.g.,

      <xsd:complexType name="myComplexType">
      <xsd:all>
      <xsd:element name="data" type="typens:ArrayOfInt"/>
      </xsd:all>
      </xsd:complexType>

      <xsd:complexType name="ArrayOfInt">
      <xsd:complexContent>
      <xsd:restriction base="soapenc:Array">
      <xsd:attribute ref="soapenc:arrayType"
      wsdl:arrayType="xsd:int[]"/>
      </xsd:restriction>
      </xsd:complexContent>
      </xsd:complexType>

      Here is an example WSDL file including the above:

      <?xml version="1.0"?>

      <definitions name="MyService" targetNamespace="urn:typens"
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      xmlns:typens="urn:typens"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <types>
      <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="urn:typens">

      <xsd:complexType name="myComplexType">
      <xsd:all>
      <xsd:element name="data" type="typens:ArrayOfInt"/>
      </xsd:all>
      </xsd:complexType>

      <xsd:complexType name="ArrayOfInt">
      <xsd:complexContent>
      <xsd:restriction base="soapenc:Array">
      <xsd:attribute ref="soapenc:arrayType"
      wsdl:arrayType="xsd:int[]"/>
      </xsd:restriction>
      </xsd:complexContent>
      </xsd:complexType>

      </xsd:schema>
      </types>

      <message name="myMethodRequest">
      <part name="mydata" type="typens:myComplexType"/>
      </message>
      <message name="myMethodResponse">
      <part name="mydata" type="typens:myComplexType"/>
      </message>

      <portType name="MyServicePort">

      <operation name="myMethod">
      <input message="typens:myMethodRequest"/>
      <output message="typens:myMethodResponse"/>
      </operation>

      </portType>

      <binding name="MyServiceBinding" type="typens:MyServicePort">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <operation name="myMethod">
      <soap:operation soapAction="urn:typensAction"/>
      <input>
      <soap:body use="encoded" namespace="urn:typens"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </input>
      <output>
      <soap:body use="encoded" namespace="urn:typens"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </output>
      </operation>

      </binding>
      <service name="MyServiceService">
      <port name="MyServicePort" binding="typens:MyServiceBinding">
      <soap:address location="http://127.0.0.1/soap"/>
      </port>
      </service>

      </definitions>

      The stubs are generated without any errors:

      1. java org.apache.axis.wsdl.wsdl2ws.WSDL2Ws -ostubs -lc++ -sclient example.wsdl
        log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle).
        log4j:WARN Please initialize the log4j system properly.

      Code generation completed.

      However, when I try to compile this, I get the following:

      1. g++ -c -I. -Istubs -Iaxis-c-1.6b-Linux-trace-bin/include stubs/myComplexType.cpp
        stubs/myComplexType.cpp: In member function 'void myComplexType::setdata(axiscpp::xsd__int_Array**)':
        stubs/myComplexType.cpp:37: error: request for member 'clone' in '((myComplexType)this)->myComplexType::data', which is of non-class type 'axiscpp::xsd__int_Array*'
        stubs/myComplexType.cpp: In function 'int Axis_Serialize_myComplexType(myComplexType*, axiscpp::IWrapperSoapSerializer*, bool)':
        stubs/myComplexType.cpp:65: error: no matching function for call to 'axiscpp::IWrapperSoapSerializer::serializeBasicArray(axiscpp::xsd__int_Array**&, axiscpp::XSDTYPETag, const char [5])'
        axis-c-1.6b-Linux-trace-bin/include/axis/IWrapperSoapSerializer.hpp:108: note: candidates are: virtual int axiscpp::IWrapperSoapSerializer::serializeBasicArray(const axiscpp::Axis_Array*, axiscpp::XSDTYPE, const char*)
        axis-c-1.6b-Linux-trace-bin/include/axis/IWrapperSoapSerializer.hpp:111: note: virtual int axiscpp::IWrapperSoapSerializer::serializeBasicArray(const axiscpp::Axis_Array*, const char*, axiscpp::XSDTYPE, const char*)
        stubs/myComplexType.cpp: In function 'int Axis_DeSerialize_myComplexType(myComplexType*, axiscpp::IWrapperSoapDeSerializer*)':
        stubs/myComplexType.cpp:79: error: cannot convert 'axiscpp::xsd_int_Array*' to 'axiscpp::xsd_int_Array**' in assignment
        stubs/myComplexType.cpp:81: error: request for member 'clone' in '* param->myComplexType::data', which is of non-class type 'axiscpp::xsd__int_Array*'
        stubs/myComplexType.cpp: In member function 'void myComplexType::reset()':
        stubs/myComplexType.cpp:163: error: request for member 'clear' in '((myComplexType)this)->myComplexType::data', which is of non-class type 'axiscpp::xsd__int_Array*'

      If the array elements in ArrayOfInt are instead wrapped to use
      a complex type that just wraps an individual xsd type, the
      generated code compiles. This is one possible workaround I
      suppose. Nevertheless, this seems like it is potentially a bug.

      bnc

      Attachments

        Activity

          People

            Unassigned Unassigned
            bnc Brent N. Chun
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: