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

         Key: AXISCPP-980
         URL: http://issues.apache.org/jira/browse/AXISCPP-980
     Project: Axis-C++
        Type: Bug

  Components: Client - Stub  
    Versions:  1.6 Beta    
 Environment: Linux Fedora Core 4, 
# g++ -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info --enable-shared --enable-threads=posix 
--enable-checking=release --with-system-zlib --enable-__cxa_atexit 
--disable-libunwind-exceptions --enable-libgcj-multifile 
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk 
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre 
--host=i386-redhat-linux
Thread model: posix
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)

    Reporter: Brent N. Chun


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:

# 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:

# 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


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to