[Mono-devel-list] SoapHttpClientProtocol::Invoke returns XmlNode instead of system type

Yannick Jost yjost at perinfo.com
Tue Sep 14 05:26:27 EDT 2004


Hi,

I noticed a strange behaviour of my mono proxy when trying to use a
gSOAP-generated WebService with Mono.
It is similar to bug #49729
(http://bugzilla.ximian.com/show_bug.cgi?id=49729). But I think this one
has been fixed in the release I'm using (Mono 1.0.1).
Here is a short example with a service doing an addition.

The problem is that the proxy generated by wsdl throws an
InvalidCastException when trying to cast the result from the webservice to
a double.

Unhandled Exception: System.InvalidCastException: Cannot cast from source
type to destination type.
in <0x000e0> Calculator:add (double,double)
in <0x000ad> Calc:Main ()

In the proxy, this line calls the service :

System.Object[] results = this.Invoke("add", new object[] {a,b});

But the following line prints "System.Double" under VS.NET and
"System.Xml.XmlNode[]" under mono

System.Console.WriteLine("{0}",results[0].GetType());

Thus, this line is throwing the exception under mono and returns the good  
result
with VS.NET :

return ((double)(results[0]));

Here is a sample response from the server :

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="urn:calc"><SOAP-ENV:Body
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
id="_0"><ns:addResponse><result>30</result></ns:addResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Is this a bug or the bug #49729 again ? Am I wrong somewhere ? Or should I  
try to modify gSOAP's answer ?

Thanks,

Yannick




More information about the Mono-devel-list mailing list