473,785 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capture XML Response

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
Jan 11 '07 #1
12 14628
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" <tb***@newsgrou p.nospamwrote in message
news:up******** ******@TK2MSFTN GP04.phx.gbl...
>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


Jan 11 '07 #2
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" <a_********@hot mail.comwrote in message
news:uY******** ******@TK2MSFTN GP06.phx.gbl...
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" <tb***@newsgrou p.nospamwrote in message
news:up******** ******@TK2MSFTN GP04.phx.gbl...
>>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



Jan 11 '07 #3
Check out the MSDN docs:
ms-help://MS.MSSDK.1033/MS.NETFX30SDK.1 033/cpref26/html/T_System_Web_Se rvices_Protocol s_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" <tb***@newsgrou p.nospamwrote in message
news:up******** ******@TK2MSFTN GP04.phx.gbl...
>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


Jan 11 '07 #4
Hello Tom,

Normally, for interactive diagnostic, we will use some trace utiilty like
tcptrace , soaptoolkit+tra ceutility. For your scenario, if you want to
programmaticall y 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.
Jan 12 '07 #5
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" <r@gmail.comwro te in message
news:uk******** ******@TK2MSFTN GP06.phx.gbl...
Check out the MSDN docs:
ms-help://MS.MSSDK.1033/MS.NETFX30SDK.1 033/cpref26/html/T_System_Web_Se rvices_Protocol s_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" <tb***@newsgrou p.nospamwrote in message
news:up******** ******@TK2MSFTN GP04.phx.gbl...
>>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



Jan 12 '07 #6
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]" <st*****@online .microsoft.comw rote in message
news:Dm******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hello Tom,

Normally, for interactive diagnostic, we will use some trace utiilty like
tcptrace , soaptoolkit+tra ceutility. For your scenario, if you want to
programmaticall y 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.


Jan 12 '07 #7
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.

Jan 15 '07 #8
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]" <st*****@online .microsoft.comw rote in message
news:qK******** ******@TK2MSFTN GHUB02.phx.gbl. ..
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.

Jan 15 '07 #9
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.

Jan 16 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
7041
by: Mathieu Blais | last post by:
Hi, I need to capture the Script timeout error if that is possible. I know I can increase the timeout value in the server settings or in the scripts itself but I really want to make sure that no timeout situation will results as the standard script timeout error page. Can we do this ?? Help please.
9
2722
by: Jay Donnell | last post by:
I have a function that is a few thousand lines of code (I didn't write it) and I want to capture the output and save it as a variable. This is very easy to do in php. It would look something like this. <?php function myFunc(){ echo "something else" }
2
10641
by: William Ortenberg | last post by:
I'm creating a new row in a table with via the AddNew method, where the table ID is an Autonumber field. I want to capture the value of the ID after I create the row. There are no other unique indices in the table. Can I do this? Thanks in advance.
5
2383
by: TerryWilson | last post by:
I am developing a web based service tool using asp.net that we will distribute with our product. This service tool will be used for remotely configuring the product, problem determination, etc. One thing that I would like to be able to do is display a screen capture of our product running. I have the code to get the screen capture of the desktop and I also know how to send the image back to the client to be displayed. The problem is that...
4
4814
by: Bill Manring | last post by:
I need to capture the event when the user closes the browser in my application. I have some code in the session_End event, which works fine when the session times out, but I need to end the session immediately when the user closes the browser. Does anyone know a way of doing this? -- Thanks,
1
806
by: feng | last post by:
I have a VB.Net program that consumes a web service. When calling the web service from my program, I would like to be able to capture and evaluate the request xml going out and the response xml that comes back. I think this is very important in debugging (that's what I am doing now). But I couldn't figour out how to do it. Could some one show me how to capture these files from the client side? Thanks a million! Feng
1
3394
by: sangith | last post by:
Hi, I tried the packet capture module program. I did a file transfer using ftp from this host to another server. But when I ran the program, it was just hanging off and it did not print the src ip, dst ip, src port, dst port. Should I run this program as a Daemon? If so, how do I do that? I would appreciate your response.
6
7987
by: k.vanderstarren | last post by:
Hi Everyone, Do any of you gurus out there have any suggestions regarding capturing audio/video from a video capture card in C#. Although I've written other programs, I've never worked with audio/video sources before. I've seen other people recommending DirectShow.NET. Is this one of the more popular libraries to use? Would anyone recommend other third- party libraries? Thanks,
5
3163
by: vasilis | last post by:
I have a list box in a site with which I capture a selected value with the onChange event using the capture_value() function (code listed below). This function passes 2 arguments, i.e., 'str' which is the selected list box value and 'passed_url' which is a passed url for running a php script (which contains some url query parameters, e.g. 'somescript.php?var1=value1&var2=value2&var3=value3'). The capture_value() function actually sends a...
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.