Debugging CFML
March 22, 2010 3:51 PM Subscribe
Trying to invoke a remote web service in ColdFusion and I want to see the exact request that's being generated and sent out.
I'm using some code like this:
<cfinvoke
webservice="https://www.webhost.com/path/to/webservice.asmx"
method="getUsername"
returnvariable="myuservar"
username="username"
password="p@55w0rd">
<cfinvokeargument name="useremail" value="sample@data.com"/>
<cfinvokeargument name="userpass" value="samplepass"/>
</cfinvoke>
How can I view the SOAP request that ColdFusion is generating from that? If it turns out ColdFusion's not formatting things in a way the web service wants, how else can I make a request with more control over the arrangement of the XML?
I'm using some code like this:
<cfinvoke
webservice="https://www.webhost.com/path/to/webservice.asmx"
method="getUsername"
returnvariable="myuservar"
username="username"
password="p@55w0rd">
<cfinvokeargument name="useremail" value="sample@data.com"/>
<cfinvokeargument name="userpass" value="samplepass"/>
</cfinvoke>
How can I view the SOAP request that ColdFusion is generating from that? If it turns out ColdFusion's not formatting things in a way the web service wants, how else can I make a request with more control over the arrangement of the XML?
Response by poster: Unfortunately, I don't have that level of access to the server. I'm really hoping to find something I can run within ColdFusion itself. Barring that, a public-access web service I can invoke that simply returns my request verbatim. That would be sufficient for debugging, and surely one exists somewhere... right?
posted by The Winsome Parker Lewis at 8:02 PM on March 22, 2010
posted by The Winsome Parker Lewis at 8:02 PM on March 22, 2010
How can I view the SOAP request that ColdFusion is generating from that?
Could you maybe just replace "https://www.webhost.com/path/to/webservice.asmx" with the path to your own quick and dirty thingy that just echoes out what it's receiving?
posted by juv3nal at 8:25 PM on March 22, 2010
Could you maybe just replace "https://www.webhost.com/path/to/webservice.asmx" with the path to your own quick and dirty thingy that just echoes out what it's receiving?
posted by juv3nal at 8:25 PM on March 22, 2010
If you're on windows, you might try Fiddler. It will let you view the request and response and also let you craft your own.
posted by duckus at 8:28 PM on March 22, 2010
posted by duckus at 8:28 PM on March 22, 2010
(1) Have you tried Stack Overflow for questions like this?
(2) I had a very similar problem recently, so I just hacked up this http proxy to rewrite the path of the request and print the request (and, optionally, response). Then I replaced https://www.webhost.com/path/to/webservice.asmx with http://localhost:8080/path/to/webservice.asmx. This was sufficient to prove that the problem was on the other end :)
posted by novalis_dt at 9:46 PM on March 22, 2010
(2) I had a very similar problem recently, so I just hacked up this http proxy to rewrite the path of the request and print the request (and, optionally, response). Then I replaced https://www.webhost.com/path/to/webservice.asmx with http://localhost:8080/path/to/webservice.asmx. This was sufficient to prove that the problem was on the other end :)
posted by novalis_dt at 9:46 PM on March 22, 2010
Charles is pretty great for this. It's similar to fiddler, but much better (interface-wise). It pretty-prints JSON and XML, and can parse AMF if you're into it. You can even rewrite and edit requests. The free version will run unrestricted for 1/2 hour before you need to restart it.
posted by klanawa at 10:01 PM on March 22, 2010 [1 favorite]
posted by klanawa at 10:01 PM on March 22, 2010 [1 favorite]
Response by poster: Thanks for the suggestions, I'll look into those. Does anybody know the structure of requests generated by <cfinvoke> as a general rule? It must follow some basic template.
posted by The Winsome Parker Lewis at 7:52 AM on March 23, 2010
posted by The Winsome Parker Lewis at 7:52 AM on March 23, 2010
This thread is closed to new comments.
posted by 3mendo at 6:53 PM on March 22, 2010