[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1047
  • Last Modified:

view the soap envelope xml that is generated when calling web service in C#

I have a C# console application that makes a call to an external web service function.  I used the wsdl wizard to import the wsdl file and create the class to make the call.  It works fine.

My question is, when I make a call to the web service I would like to view the xml that is generated for the call.  Any guidance appreciated.
0
dhenderson12
Asked:
dhenderson12
  • 2
  • 2
1 Solution
 
samrellisCommented:
Option 1 - use a network sniffer like wireshark

Option 2 -
 - if your web service is simple
 - you have used visual studio to generate the service
you should be able to browse to it with your web browser on the local machine, or development machine where it is situated, and use the generated web gui to see the results of all methods

good luck and good night
0
 
Gary DavisDir Internet SvcsCommented:
Try Fiddler (http://www.fiddlertool.com) to see the request and response. Fiddler is a useful, free debugging tool for viewing the Http protocol messages between a browser and server.
Gary Davis
0
 
dhenderson12Author Commented:

I'm missing something.

The feed is a third party feed, so I can't debug in vs2008.

The envelope is specified as:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Import xmlns= LEFT BLANK FOR PRIVACY  />
      <requestXml> THE REQUEST GOES HERE </requestXml>
    </Import>
  </soap:Body>
</soap:Envelope>

I have imported the WSDL for this service into my application, and the wizard created the web service client, so all I do is call it like this:
     string response = <function name>(requestXML); // <function name> is defined in the wsdl.

So my question really is: How do I define the soap envelope in VS2008?


0
 
dhenderson12Author Commented:

I'm missing something.

The feed is a third party feed, so I can't debug in vs2008.

The envelope is specified as:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Import xmlns= LEFT BLANK FOR PRIVACY  />
      <requestXml> THE REQUEST GOES HERE </requestXml>
    </Import>
  </soap:Body>
</soap:Envelope>

I have imported the WSDL for this service into my application, and the wizard created the web service client, so all I do is call it like this:
     string response = <function name>(requestXML); // <function name> is defined in the wsdl.

So my question really is: How do I define the soap envelope in VS2008?


0
 
Gary DavisDir Internet SvcsCommented:
All the soap stuff is handled behind the scenes. You do not have to do anything with the soap envelope. Once you import the WSDL to create the web service, your code needs to instantiate the web service and simple invoke it with the necessary parameters. The response will be returned. The request and response are strongly typed so intellisense will help in using the objects.
It's all really easy. You don't have to do anything with XML either - the Framework will handle the serialization and deserialization.
If the 3rd party web service is not DotNET, the objects returned may not be complex or maybe they will simply return XML in the string. In that case, there will be a little more work to do.
Gary
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now