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

时间:2015-02-19 12:22:11

标签: c++ web-services soap wsdl gsoap

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

因为当我使用wsdl2h生成C ++头文件时,它多次包含同一类的类定义,soapcpp2不喜欢它并抛出一些语义错误(由于重新定义了类)。

例如,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>

在使用wsdl2h后的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                          ;
    };

0 个答案:

没有答案