Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View Request SOAP for Web Service..

Status
Not open for further replies.

d2007

Programmer
May 17, 2007
18
0
0
US
Usin VS205 and VB.

I am calling a web service upon the button click event of my asp.net page.

I would like to see what the REQUEST SOAP message looks like upon calling my WS but am not certain of the easiest/best method for doing so.

I've discovered the following MSDN referenece which I believe is what I want but am having issues integrating it.


The above link contains a VB code sample that I've attempted to paste into my .vb page containing the button click event.

However, I am somewhat new to .net and still learning how these classes interact and am not sure how to adapt the code sample to my simple web service call.

Here is the code I have calling my ws that I would like to modify to view the SOAP request XML that is created:

Dim ws As New myservice
ws.webmethod("xx", "xx", "xx", "xx", "xx", "xx")

Basically, I am wondering if I am on the right track and if so, is there an easy way to integrate the sample code I've referenced?

Thanks very much in advance for any help, etc.
 
If I remember correctly, you're working with a web service client, correct (you're modifying the code that calls the web service, not the web service itself)?

The SoapExtension will only help you if you're modifying the service itself, not the client.

Did you check out Fiddler yet?


MCP, MCTS - .NET Framework 2.0 Web Applications
 
Yes, I am working on the client end. I am only consuming the web service.

I have installed Fidler but cannot seem to view the Full SOAP request that gets generated -- perhaps I am not looking in the correct spot -- as I have not used it before.

On a related note (something I am strugling with)
The web service I am trying to consume requires an object to be sent as the parameter for the web service method.
i.e. mybservice.webmethod(payload)

I believe the payload object should be a SOAP element. I am trying to convet an existing .xml file to be used as the payload object.

Any ideas as to the best method for accomplishing this?

Thank you very much for you time.
 
Fiddler should give you this stuff. Have a look through the documentation and i'll do the same.

David Kuhn
 
I will have a look.

It seems I can see request SOAP when the service is not https.

When https, I cannot seem to see it.
 
Thanks, I took a quick look but still can't get the request to appear.

Here is somthing I just can't seem to get my head around and could really use some help. I have been researching the web but just can't seem to find the solution.

The web service I am calling expects a "Payload" object to be sent as a SOAP element inside the body tag.

I think this Payload is suppose to be an xml document that I build. I have a sample .xml document that I would like to attach as the Payload when Calling the service but am not sure how to do this.

dim ws as new mywebservice
dim p as new payload

now I need to assign a value to Payload (I want to assign it the value of the .xml document I have)

p.???

Any Help greatly appreciated.
 
.NET prevents you from having to do anything so clumsy. By adding a web reference, .NET will generate a proxy that lets you interact with the web service as if it were a strongly typed object.

Thus, the code:

Code:
Dim ws As New myservice
ws.webmethod("xx", "xx", "xx", "xx", "xx", "xx")

...will generate all the XML SOAP messages for you.

This feature is arguably one of the stongest of the .NET framework. It makes working with web services a snap.



MCP, MCTS - .NET Framework 2.0 Web Applications
 
Yeah, my issue is that the web service seems to be a bit more complex.

Instead of accepting several different parameters for the webservice method, it receives a single object (payload).

This object is actually xml itself. Following is an example of what the SOAP Body portion of the request should look like when done correctly.

<soap:Body>
<ProcessMessage xmlns="xxx" >
<payload>
<content id="Content0">
<ProcessOrder revision="xxx" release="xxx" environment="xxx" lang="xxx" bodVersion="xxx" xmlns="xxx">

</ProcessOrder>
</content>
</payload>
</ProcessMessage>
</soap:Body>

Where processmessage is the method and payload is the object I see associated with the web service class in .net.

The ProcessOrder portion will contain several related elements.

Based on my understanding, I need to populate the payload object with this process order xml.

Thanks again.
 
Who's web service are you trying to hack?

Maybe you should contact them and get the documentation for thier web service. The documentation should provide you with the XML Payload definition.

Senior Software Developer
 
Based on my understanding, I need to populate the payload object with this process order xml.

Unless the service provider didn't know what they were doing and botched the design of the web service (which is unfortunately fairly common), then you should be able to use strongly typed objects of a proxy instead of having to deal directly with any XML.

If you post the WSDL for the service and we can throw together a sample client.

MCP, MCTS - .NET Framework 2.0 Web Applications
 
Thanks for all the input -- appreciated.

I think I was able to resolve. Still working on some issues with the header and security -- trying to resolve with SOAP extensions.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top