atom feed2 messages in com.yahoogroups.gsoap[gsoap] New user, question re: pointe...
FromSent OnAttachments
gpu.laplaceJun 9, 2008 9:39 am 
dfk_singletonJun 11, 2008 11:02 pm 
Subject:[gsoap] New user, question re: pointer to type vs type
From:gpu.laplace (
Date:Jun 9, 2008 9:39:37 am


Just starting out with gSOAP, and have a quick question regarding the eradication of pointer usage.

The type we are defining in the WSDL is as:

<xsd:complexType name="TypeArray"> <xsd:sequence> <xsd:element name="TypeID" type="xsd:int" maxOccurs="unbounded" minOccurs="1"></xsd:element> <xsd:element name="TypeDescription" type="xsd:string" maxOccurs="unbounded" minOccurs="1"></xsd:element> </xsd:sequence> </xsd:complexType>

Which generates the following class definition:

class ns1__TypeArray { public: /// SEQUENCE OF ELEMENTS minOccurs="1" maxOccurs="unbounded" int __size_TypeArray_sequence 1; class __ns1__TypeArray_sequence { /// Vector of int with length 1..unbounded std::vector<int> TypeID 1; /// Vector of std::string with length 1..unbounded std::vector<std::string> TypeDescription 1; } *__TypeArray_sequence; // END OF SEQUENCE /// A handle to the soap struct that manages this instance (automatically set) struct soap *soap; };

And the following response definition:

struct ns1__getTypesResponse { ns1__TypeArray* Types; };

In order to utilize these classes, I must instantiate a new ns1_TypeArray:

// Here... result.Types = new ns1__TypeArray;

// Subsequent additions are done through a std::vector as desired... for(size_t i = 0; i < res.num_rows(); i++) { result.Types->TypeID.push_back(res[i][0]); result.Types-



Is there any way that I can alter the WSDL so that ns1__getTypesResponse::Types is of type ns1__TypeArray and not ns1__TypeArray* ?

I'm just not sure why the gSOAP system would utilize a pointer here, when I only need one instance. Even then, if multiple instances were required, why wouldn't a std::vector be used?

I am sure that I am missing something simple. Any help is much appreciated.

- Shawn