0

I am generating a wsdl file from a C header file while contains similar types of structures. Using soapcpp2, I am able to generate wsdl file which contains duplicate complexTypes as some structures were similar. Is there any way to get of redundant complexTypes?

Because when I am using wsdl2h to generate C++ header file, it contains the class definition for same class multiple times and soapcpp2 does not like it and throws some semantic errors (due to redefinition of class).

for example, a complexType in wsdl file :

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

In C++ header after using wsdl2h,

    /// 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                          ;
    };
Pankaj Goyal
  • 1,448
  • 3
  • 15
  • 25
  • I feel your pain. My approach to dealing with this was to use something modern to generate the WSDL file. I used C# and the ServiceStack library to create a set of DTO classes and a simple Soap service that automatically generated the WSDL. I fed this WSDL into soapcpp2 and got some C++ classes, which I was then able to use. Might not be ideal but worked for me. – Paul Rooney Feb 19 '15 at 12:45
  • For same class with multiple definitions, you should use vectors. – Kahn Feb 19 '15 at 13:27

0 Answers0