0

Using gsoap, I have created a client for a soap server. In wsdl from which I created my sources there is a type with an element of type NotificationMessage as defined in wsnt.
Is there any way to convert it to a custom object?
I need something like following:

/* get response */
_wsnt__NotificationMessageHolderType_Message message = response.Message;
if (message is _tt__Message)
{
    _tt__Message m = message as _tt__Message;
    /* do something with m */
} else if (message is std::string) {
    std::string str = message as std::string;
    /* do something with str */
} else {
    Warning("Unrecognized type");
}

Any help would be appreciated!

Omid
  • 25
  • 5

1 Answers1

0

Perhaps use wsdl2h option -d? This generates code that adds DOM support (do not use option -x at the same time).

A DOM node graph xsd__anyType holds the content of Message. The DOM content can be set and read, and may also contain serializable data, as described in XML DOM and XPath for gSOAP.

To enable serialization of C/C++ within an XML DOM, use SOAP_DOM_NODE. The XML element tag name should match with the name of a C/C++ type to deserialize it automatically into a C/C++ object.

Because the _wsnt__NotificationMessageHolderType_Message class is embedded you cannot give an overriding definition in typemap.dat as you can do for globally defined classes (at least not with gSOAP up to 2.8.28).

Dr. Alex RE
  • 1,772
  • 1
  • 15
  • 23