[Mono-list] Retrieve SOAP message

Christian Birkl christian.birkl at gmail.com
Thu Nov 16 17:20:22 EST 2006


FYI - there are 2 other ways of doing this:

1) Use a SoapInput/OutputFilter

@see:
http://msdn.microsoft.com/library/en-us/wseref/html/T_Microsoft_Web_Services2_SoapInputFilter.asp?frame=true
@see:
http://msdn.microsoft.com/library/en-us/wseref/html/T_Microsoft_Web_Services2_SoapOutputFilter.asp?frame=true

2) Use a SoapExtension

@see:
http://msdn2.microsoft.com/en-US/library/system.web.services.protocols.soapextension.aspx
(especially
stages BeforeDeserialize and AfterSerialize, depending on if it's either a
SoapClient oder SoapServerMessage).

Though I don't know if mono's WSE support yet includes and supports those
classes.

Christian

2006/11/16, Juan Cristóbal Olivares <juancri at gmail.com>:
>
> 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
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20061116/498ee33c/attachment-0001.html 


More information about the Mono-list mailing list