C++ 如何使用gsoap避免wsdl文件中重复的复杂类型?

C++ 如何使用gsoap避免wsdl文件中重复的复杂类型?,c++,web-services,soap,wsdl,gsoap,C++,Web Services,Soap,Wsdl,Gsoap,我从C头文件生成wsdl文件,同时包含类似类型的结构。 使用soapcpp2,我能够生成wsdl文件,其中包含重复的complexTypes,因为某些结构类似。有没有办法获得多余的复杂类型 因为当我使用WSDL2H生成C++头文件时,它包含了同一个类的多个类定义,SOAPCP2不喜欢它,并且由于类的重新定义而引发了一些语义错误。 例如,wsdl文件中的complexType: <complexType name="ArrayOfint"> <complexConten

我从C头文件生成wsdl文件,同时包含类似类型的结构。 使用soapcpp2,我能够生成wsdl文件,其中包含重复的complexTypes,因为某些结构类似。有没有办法获得多余的复杂类型

因为当我使用WSDL2H生成C++头文件时,它包含了同一个类的多个类定义,SOAPCP2不喜欢它,并且由于类的重新定义而引发了一些语义错误。 例如,wsdl文件中的complexType:

  <complexType name="ArrayOfint">
   <complexContent>
    <restriction base="SOAP-ENC:Array">
     <sequence>
      <element name="item" type="xsd:int" minOccurs="0" maxOccurs="unbounded" nillable="false"/>
     </sequence>
     <attribute ref="SOAP-ENC:arrayType" WSDL:arrayType="xsd:int[]"/>
    </restriction>
   </complexContent>
  </complexType>

我感觉到你的痛苦。我处理这个问题的方法是使用一些现代的东西来生成WSDL文件。我使用C和ServiceStack库创建了一组DTO类和一个自动生成WSDL的简单Soap服务。我把这个WSDL移植到SOAPCP2中,得到了一些C++类,然后我就可以使用它们。可能不太理想,但对我来说很有效。对于具有多个定义的同一类,应该使用向量。
    /// class ArrayOfint operations:
    /// - soap_new_ArrayOfint(soap*) allocate
    /// - soap_new_ArrayOfint(soap*, int num) allocate array
    /// - soap_new_req_ArrayOfint(soap*, ...) allocate, set required members
    /// - soap_new_set_ArrayOfint(soap*, ...) allocate, set all public members
    /// - int soap_read_ArrayOfint(soap*, ArrayOfint*) deserialize from a stream
    /// - int soap_write_ArrayOfint(soap, ArrayOfint*) serialize to a stream
    /// SOAP encoded array of xs:int.
    class ArrayOfint
    { public:
    /// Pointer to array of int.
        int                                 *__ptritem                     ;
    /// Size of the dynamic array.
        int                                  __size                        ;
    /// Offset for partially transmitted arrays (uncomment only when required).
    //  int                                  __offset                      ;
    /// A handle to the soap struct that manages this instance (automatically set).
        struct soap                         *soap                          ;
    };