vendredi 8 mai 2015

Downcasting SOAP Response in gSoap

I currently have a web service written in J2EE which has a webservice which looks something like this in the generated gSoap proxy class:

performAction(CommandAction *actionIn, BaseClass &actionOut)

Depending on the actionIn, the actionOut result can be one of several child classes of BaseClass. In order for me to access the results, i need to be able to cast actionOut to the correct derived class and access member variables.

The resulting XML looks something like this:

...

<ns1:performAction xsi:type="ns2:DerivedClass" xmlns:ns2="blah..">
<data>Hello</data>
</ns1:performAction>

....

The data variable is only present in the Derived class.

So far i have tried passing in derived class objects to the method but the derived member variables remain empty or null. Any advice would be appreciated.

Aucun commentaire:

Enregistrer un commentaire