[Mono-list] Retrieve SOAP message

Juan Cristóbal Olivares juancri at gmail.com
Thu Nov 16 02:21:28 EST 2006


Sébastien Mosser asked how to retrieve the SOAP message from a web service.
I have good and bad news. The good news is "it's possible" the bad news is
"mono bug".

Ok, this is the explanation. I tried in Microsoft .NET first because of the
documentation. I did this:

using System.IO;
....
....
[WebMethod]
public string Test (string argument1, string argument2)
{
    using (StreamReader reader = new StreamReader (
this.Context.Request.InputStream))
        return reader.ReadToEnd ();
}

With POST method it worked OK, I received

argument1=sometext&argument2=othertext

but it didn't work with SOAP, so I tried this hack:

[WebMethod]
public string Test (string argument1, string argument2)
{
    Stream stream = this.Context.Request.InputStream;
    stream.Seek (0, SeekOrigin.Begin);
    using (StreamReader reader = new StreamReader (stream))
        return reader.ReadToEnd ();
}

and it worked great:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema"><soap:Body><Test xmlns="
http://tempuri.org/"><argument1>hola</argument1>
<argument2>bye</argument2></Test></soap:Body></soap:Envelope>

But it's not working with my mono installation... anybody else can try?

Juan C. Olivares
www.juancri.com


-- 
Juan Cristóbal Olivares
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20061116/e60d7b27/attachment.html 


More information about the Mono-list mailing list