StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


12»»

Debugging a web serviceExpand / Collapse
Author
Message
Posted 06/29/2007 10:04:55 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 12:10:08 PM
Posts: 1,327, Visits: 3,471
I working with a web service for the first time and I'm having trouble getting it to work. The web service was built by someone else, in java and the server is remote and I don't have access to the source to try to have it local.

I really need to see what the raw soap message being sent to the web service is. However, I can't figure out how to do this. Any ideas on how to do this?

Any other tricks/tips on building clients for web services would be appreciated (including how SF could be leveraged) would be appreciated.

Thanks!
Post #9850
Posted 07/02/2007 8:55:38 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 1:09:23 PM
Posts: 2,686, Visits: 1,888
If you need to see the raw SOAP message, then you're best bet would be to create a quick little program that will read it and dump it to a file on disk.  Something like this:

Private Sub GetAndSaveResponse()
    Dim request As HttpWebRequest = DirectCast(WebRequest.Create("some url to the web service"), HttpWebRequest)
    Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)

    Dim input As Stream = response.GetResponseStream()
    Dim buffer As Byte(response.ContentLength - 1)
   
    input.Read(buffer, 0, response.ContentLength)

    File.WriteAllBytes("C:\output.txt", buffer)
End Sub

You'll of course, need to import System.IO and System.Net and I think that's all...

It's pretty quick and dirty, but it should get you a start


www.bungie.net
Post #9879
Posted 07/02/2007 8:57:36 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 1:09:23 PM
Posts: 2,686, Visits: 1,888
For some reason I remember that in VB, you can only put the dimensions on an array declaration on the variable name or the type... don't remember which one off hand, so the:

Dim buffer As Byte(response.ContentLength - 1)

might need to be:

Dim buffer(response.ContentLength - 1) As Byte


www.bungie.net
Post #9881
Posted 07/02/2007 10:16:43 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 12:10:08 PM
Posts: 1,327, Visits: 3,471
Thanks for the reply Ben.

Will this work with a proxy class? I.e. I'm using a proxy class to call the web service and I'd like to know what the SOAP message the proxy is generating is (because the darned thing ain't workin). The web service is somebody else's and is a java web service.

Thanks again!
Post #9903
Posted 07/03/2007 9:00:59 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 1:09:23 PM
Posts: 2,686, Visits: 1,888
Yes, when you create the HttpWebRequest object, you can set any of the properties you need before you make the call to GetResponse(), which is what actually sends the request and gets the response.  One of the properties you can set before sending the request is the Proxy property which accepts a System.Net.IProxy object... don't worry, though, there's already an implementation of that interface in the System.Net.WebProxy class.  Just create a new WebProxy object, give it the address, port, username, password, etc. for the proxy and set that object to the Proxy property on your HttpWebRequest object.  Now, if you want to see what the proxy is passing on to the web service, you'll have to set up a packet sniffer between the proxy and the web server, which could prove to be difficult.


www.bungie.net
Post #9925
Posted 07/03/2007 1:41:54 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 12:10:08 PM
Posts: 1,327, Visits: 3,471
Thanks Ben! I'll need to chew on this for a bit, but it is heading me in the correct direction I'm sure.
Post #9939
Posted 07/09/2007 3:34:11 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 12:10:08 PM
Posts: 1,327, Visits: 3,471
Well, I've chewed and I'm choking...

Let me get this straight. I have a proxy class that will end up generating a soap message (which is just a plain text, xml string) and the only way I can see what is being generated is by setting up a proxy class and using a bloody port sniffer? They couldn't just have an option to show the bloody message? #@#%^#@

Somebody at MS needs to be shot!

OK, enough of the rant. Is this really the only way to see what is being sent? (I realize this might be easy to you, but I know next to nothing about port sniffers and proxies...so I'm looking at another bloody steep hill to climb...sigh...starting to rant again). I'm getting a bad header and need to know what I'm doing wrong.

Thanks!
Post #10121
Posted 07/09/2007 5:16:04 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 4:50:35 PM
Posts: 4,796, Visits: 4,766
Is this really the only way to see what is being sent?

LOL....I understand.  Really if you want to get a true view of what is going on, then the port sniffer is the best way to go. We have learned all sorts of junk through the port sniffers

Post #10124
Posted 07/09/2007 6:43:24 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 12:10:08 PM
Posts: 1,327, Visits: 3,471
Sigh....OK, I'll bite the bullet and learn to sniff...
Post #10128