gSOAP with OPC XML-DA add attribute

ryderxxl

New Member
I'm trying to develop a soap client that will access data over the OPC XML-DA specification: HereI've used the tools provided by gSOAP to generate the gSOAP header file from the OPC Foundations WSDL. (Relevant parts below)I can't seem to get gSOAP to properly add an attribute to the tag. (See Output section below). Is there a builtin way to do this, or will the WSDL/gSOAP header need to be modified?WSDL extract:<s:complexType name="ItemValue"><s:sequence><s:element minOccurs="0" maxOccurs="1" name="DiagnosticInfo" type="s:string" /><s:element minOccurs="0" maxOccurs="1" name="Value" /><s:element minOccurs="0" maxOccurs="1" name="Quality" type="s0:OPCQuality" /></s:sequence><s:attribute name="ValueTypeQualifier" type="s:QName" /><s:attribute name="ItemPath" type="s:string" /><s:attribute name="ItemName" type="s:string" /><s:attribute name="ClientItemHandle" type="s:string" /><s:attribute name="Timestamp" type="s:dateTime" /><s:attribute name="ResultID" type="s:QName" /></s:complexType>Generated gSOAP headerclass ns1__ItemValue{ public:/// Element DiagnosticInfo of type xs:string. char* DiagnosticInfo 0; ///< Optional element./// Element 'Value' has no type or ref: assuming XML content. _XML Value 0; ///< Optional element./// Element Quality of type "http://opcfoundation.org/webservices/XMLDA/1.0/":OPCQuality. ns1__OPCQuality* Quality 0; ///< Optional element./// Attribute ValueTypeQualifier of type xs:QName. @_QName ValueTypeQualifier 0; ///< Optional attribute./// Attribute ItemPath of type xs:string. @char* ItemPath 0; ///< Optional attribute./// Attribute ItemName of type xs:string. @char* ItemName 0; ///< Optional attribute./// Attribute ClientItemHandle of type xs:string. @char* ClientItemHandle 0; ///< Optional attribute./// Attribute Timestamp of type xs:dateTime. @time_t* Timestamp 0; ///< Optional attribute./// Attribute ResultID of type xs:QName. @_QName ResultID 0; ///< Optional attribute./// A handle to the soap struct that manages this instance (automatically set) struct soap *soap ;};Generated Codeclass SOAP_CMAC ns1__ItemValue{public: char *DiagnosticInfo; /* optional element of type xsd:string */ char *Value; /* optional element of type xsd:anyType */ class ns1__OPCQuality *Quality; /* optional element of type ns1:OPCQuality */ char *ValueTypeQualifier; /* optional attribute */ char *ItemPath; /* optional attribute */ char *ItemName; /* optional attribute */ char *ClientItemHandle; /* optional attribute */ time_t *Timestamp; /* optional attribute */ char *ResultID; /* optional attribute */ struct soap *soap; /* transient */public: virtual int soap_type() const { return 18; } /* = unique id SOAP_TYPE_ns1__ItemValue */ virtual void soap_default(struct soap*); virtual void soap_serialize(struct soap*) const; virtual int soap_put(struct soap*, const char*, const char*) const; virtual int soap_out(struct soap*, const char*, int, const char*) const; virtual void *soap_get(struct soap*, const char*, const char*); virtual void *soap_in(struct soap*, const char*, const char*); ns1__ItemValue() : DiagnosticInfo(NULL), Value(NULL), Quality(NULL), ValueTypeQualifier(NULL), ItemPath(NULL), ItemName(NULL), ClientItemHandle(NULL), Timestamp(NULL), ResultID(NULL), soap(NULL) { } virtual ~ns1__ItemValue() { }};Output<ns1:Items ClientItemHandle="Channel1.Device1" ItemName="Channel_1.Device_1.Tag_1" ValueTypeQualifier="xsd:unsignedInt"> <Value xmlns="http://opcfoundation.org/webservices/XMLDA/1.0/"> 5 </Value></ns1:Items>Needed Output<ns1:Items ClientItemHandle="Channel1.Device1" ItemName="Channel_1.Device_1.Tag_1" ValueTypeQualifier="xsd:unsignedInt"> <Value xmlns="http://opcfoundation.org/webservices/XMLDA/1.0/" xsi:Type="xsd:unsignedInt"> 5 </Value></ns1:Items>Output means the XML that is generated and sent over the wire to the remote server.
 
Back
Top