470,855 Members | 1,200 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

log contents of request

Hi All,

Is there a way to get the contents of a web service request? Preferably
including the HTTP headers too.

I tried saving Context.Request.InputStream to a stream, but it always
appears to be 0 length. Is that because it's only used in a regular Page
request and not for web services?

May 15 '06 #1
3 1097
yes there is way , we call it SOAP Extensions. By using soap extensions you
can intercept soap stream at the various stages of web service request. For
creating soap extension you have to dervice class from soap extensions. I am
giving you buzz word and you can study about SOAP extensions and can use it.
For futher help feel free to write.

"Jacob" wrote:
Hi All,

Is there a way to get the contents of a web service request? Preferably
including the HTTP headers too.

I tried saving Context.Request.InputStream to a stream, but it always
appears to be 0 length. Is that because it's only used in a regular Page
request and not for web services?

May 15 '06 #2
Jacob wrote:
Hi All,

Is there a way to get the contents of a web service request?
Preferably including the HTTP headers too.

I tried saving Context.Request.InputStream to a stream, but it always
appears to be 0 length. Is that because it's only used in a regular
Page request and not for web services?


Check out:

http://msdn.microsoft.com/library/de.../en-us/cpref/h
tml/frlrfsystemwebservicesprotocolssoapextensionclasst opic.asp

(URL Wraps. Or use http://tinyurl.com/empf)

Just dress your method with a [Trace( FileName="<enter filename
here">)] attribute and the request + response will be saved to the
file. But this applies only to the XML.

You can save the headers manually in the method itself.

--
Deepak Shenoy
http://shenoyatwork.blogspot.com
May 16 '06 #3
I have something like this in my HttpApplication subclass for tracing SOAP
calls:

protected void Application_AuthenticateRequest(Object sender, EventArgs e) {

#if DEBUG
//trace the request
HttpRequest Request = HttpContext.Current.Request;
Debug.WriteLine(Request.Headers["SOAPAction"]);
byte[] bytes = new byte[Request.ContentLength];
Request.InputStream.Read(bytes, 0, bytes.Length);
Request.InputStream.Position = 0;
UTF8Encoding encoding = new UTF8Encoding();
Debug.WriteLine(encoding.GetString(bytes));

#endif
}

May 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dexter | last post: by
4 posts views Thread by Kuldeep | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.