PC Review


Reply
Thread Tools Rate Thread

Capture XML Response

 
 
Tom Bean
Guest
Posts: n/a
 
      11th Jan 2007
I am writing a C# Windows service that calls methods on a remote web service
and would like to capture the XML returned by the web service. The reason I
need the raw XML is for back up to the sub-set of data I am saving to a
database.

All the posts I have found seem to assume one has access to both the client
and server applications but since the web service is remote, I can only
control the client side.

Any help in learning how to accomplish this will be greatly appreciated.

Thanks,
Tom


 
Reply With Quote
 
 
 
 
Ashot Geodakov
Guest
Posts: n/a
 
      11th Jan 2007
Send a regular HTTP POST request to the web server that will call the
appropriate web service, and read the returned XML as a stream.

Do you have the URL of the web service? If yes, try to type that URL in your
web browser. It will display the proper format of the HTTP request, so you
can use it.

"Tom Bean" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am writing a C# Windows service that calls methods on a remote web
>service and would like to capture the XML returned by the web service. The
>reason I need the raw XML is for back up to the sub-set of data I am saving
>to a database.
>
> All the posts I have found seem to assume one has access to both the
> client and server applications but since the web service is remote, I can
> only control the client side.
>
> Any help in learning how to accomplish this will be greatly appreciated.
>
> Thanks,
> Tom
>
>



 
Reply With Quote
 
Tom Bean
Guest
Posts: n/a
 
      11th Jan 2007
Ashot,

I call the methods using a WebReference object, created from a WSDL file,
not with HTTP POST. There is a charge for each call to the web service so I
can't afford to make the call both ways to get the data and the XML.

Tom

"Ashot Geodakov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Send a regular HTTP POST request to the web server that will call the
> appropriate web service, and read the returned XML as a stream.
>
> Do you have the URL of the web service? If yes, try to type that URL in
> your web browser. It will display the proper format of the HTTP request,
> so you can use it.
>
> "Tom Bean" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I am writing a C# Windows service that calls methods on a remote web
>>service and would like to capture the XML returned by the web service.
>>The reason I need the raw XML is for back up to the sub-set of data I am
>>saving to a database.
>>
>> All the posts I have found seem to assume one has access to both the
>> client and server applications but since the web service is remote, I can
>> only control the client side.
>>
>> Any help in learning how to accomplish this will be greatly appreciated.
>>
>> Thanks,
>> Tom
>>
>>

>
>



 
Reply With Quote
 
RYoung
Guest
Posts: n/a
 
      11th Jan 2007
Check out the MSDN docs:
ms-help://MS.MSSDK.1033/MS.NETFX30SDK.1033/cpref26/html/T_System_Web_Services_Protocols_SoapExtension.htm

Shows using a SoapExtension on the client side (your windows service) to
write outgoing and incoming XML between client and service.

Ron

"Tom Bean" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am writing a C# Windows service that calls methods on a remote web
>service and would like to capture the XML returned by the web service. The
>reason I need the raw XML is for back up to the sub-set of data I am saving
>to a database.
>
> All the posts I have found seem to assume one has access to both the
> client and server applications but since the web service is remote, I can
> only control the client side.
>
> Any help in learning how to accomplish this will be greatly appreciated.
>
> Thanks,
> Tom
>
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12th Jan 2007
Hello Tom,

Normally, for interactive diagnostic, we will use some trace utiilty like
tcptrace , soaptoolkit+traceutility. For your scenario, if you want to
programmatically capture the message and log it, you can consider using
soapExtension as Ron suggested. Soap Extension can be used at both
clientside and server-side of webservice. Here are some reference articles
you can have a look.

#Fun with SOAP Extensions
http://msdn2.microsoft.com/en-us/library/ms972353.aspx

#Using SOAP Extensions in ASP.NET
http://msdn.microsoft.com/msdnmag/is...n/default.aspx

#How to: Implement a SOAP Extension
http://msdn2.microsoft.com/en-us/library/7w06t139.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


 
Reply With Quote
 
Tom Bean
Guest
Posts: n/a
 
      12th Jan 2007
Ron,

I had looked at the TraceExtension sample before I submitted my post and
have tried to implement it in my application. The problem I'm having is
that I couldn't find the code that uses TraceExtension. How do you
implement it and make sure it gets called during the web service request and
response?

Also, I notice the document says "SOAP extensions for XML Web services
created using ASP.NET." I am not creating a web service and I am not using
ASP.NET. My application is a Windows application, so how do I implement
something like TraceExtension in it?

Tom

"RYoung" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Check out the MSDN docs:
> ms-help://MS.MSSDK.1033/MS.NETFX30SDK.1033/cpref26/html/T_System_Web_Services_Protocols_SoapExtension.htm
>
> Shows using a SoapExtension on the client side (your windows service) to
> write outgoing and incoming XML between client and service.
>
> Ron
>
> "Tom Bean" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I am writing a C# Windows service that calls methods on a remote web
>>service and would like to capture the XML returned by the web service.
>>The reason I need the raw XML is for back up to the sub-set of data I am
>>saving to a database.
>>
>> All the posts I have found seem to assume one has access to both the
>> client and server applications but since the web service is remote, I can
>> only control the client side.
>>
>> Any help in learning how to accomplish this will be greatly appreciated.
>>
>> Thanks,
>> Tom
>>
>>

>
>



 
Reply With Quote
 
Tom Bean
Guest
Posts: n/a
 
      12th Jan 2007
Steven,

All the documentation I've seen, including the articles you sent, say SOAP
extensions are implemented on the web site. I have no access to the web
site where the web service runs. I need to capture the XML in the request
and response on the client.

I must be missing something but I haven't seen anything that shows how to
implement a SOAP extension in a Windows client application. Is it possible
to do this without having access to the web service?

Tom

"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Hello Tom,
>
> Normally, for interactive diagnostic, we will use some trace utiilty like
> tcptrace , soaptoolkit+traceutility. For your scenario, if you want to
> programmatically capture the message and log it, you can consider using
> soapExtension as Ron suggested. Soap Extension can be used at both
> clientside and server-side of webservice. Here are some reference articles
> you can have a look.
>
> #Fun with SOAP Extensions
> http://msdn2.microsoft.com/en-us/library/ms972353.aspx
>
> #Using SOAP Extensions in ASP.NET
> http://msdn.microsoft.com/msdnmag/is...n/default.aspx
>
> #How to: Implement a SOAP Extension
> http://msdn2.microsoft.com/en-us/library/7w06t139.aspx
>
> Hope this helps.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      15th Jan 2007
Hello Tom,

Of course, soap extension can be applied on both sides(client and server)
of .NET implemented webservice. For client-side proxy, you also have two
means to apply a soapextension on it:

** through application's App.config file
** directly add soapextension attribute on a certain webmethod in the
generated proxy code file

Here are some web article and former thread discussing on this:

http://blogs.infosupport.com/marcelv...7/05/8615.aspx

http://www.thescripts.com/forum/thread427659.html

Hope this also helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Tom Bean
Guest
Posts: n/a
 
      15th Jan 2007
Steven,

Thanks for tolerating my lack of understanding. I followed your
instructions in the http://www.thescripts.com/forum/thread427659.html and
was able to get TraceExtension to write the SoapRequest and SoapResponse to
a file in my application.

I want to capture the raw XML especially from the SoapResponse and save it
in a table in a SQL Server database. Since the soap extension runs as part
of the proxy, how can I access the XML in TraceExtension from my client app
rather than saving it to a file?

Thanks again,
Tom

"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Tom,
>
> Of course, soap extension can be applied on both sides(client and server)
> of .NET implemented webservice. For client-side proxy, you also have two
> means to apply a soapextension on it:
>
> ** through application's App.config file
> ** directly add soapextension attribute on a certain webmethod in the
> generated proxy code file
>
> Here are some web article and former thread discussing on this:
>
> http://blogs.infosupport.com/marcelv...7/05/8615.aspx
>
> http://www.thescripts.com/forum/thread427659.html
>
> Hope this also helps.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      16th Jan 2007
Thanks for the reply Tom,

As for the SoapExtension, though it is applied on our webservice webmethod
or client proxy's webmethod, the execution of the extension is separated
from our client application(who call the webservice proxy)'s code.
Therefore, there is no directly channel for us to control or access the
soapextension intances in client application's code(or from proxy). Do you
think it is possible that you directly add the code in soapextension to
store the response SOAP XML message into database? You can put the database
connection info in the soapextension attribute so that you can flexiblly
configure it through soapextension attribute or in app.config file.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capture request/response HTTP headers with VBA =?Utf-8?B?cDNwbHly?= Microsoft Excel Programming 7 11th Mar 2007 01:01 AM
RE: how to capture saveFileDialog.OverwritePrompt Response? =?Utf-8?B?UmljaA==?= Microsoft VB .NET 0 12th Jan 2007 11:48 PM
problem with rendering page using 'Response.Redirect' and 'Response.OutputStream' André Microsoft ASP .NET 3 1st Dec 2006 07:20 AM
How to capture a response from confirm box in asp.net pargat singh Microsoft ASP .NET 1 10th Mar 2004 02:58 PM
Response.CharSet Vs Response.ContentEncoding Vs responseEncoding property in web.Config Calvin Lai Microsoft ASP .NET 6 31st Dec 2003 06:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:04 PM.