ColdFusion MX provides the following facilities for troubleshooting SOAP requests and responses:
getSOAPRequest
and getSOAPResponse
functions.
This section describes the following topics:
You can use the getSOAPRequest
and getSOAPResponse
functions to retrieve and display the XML passed to and from a web service. Although advanced users may use this information for custom functionality, you typically use these functions for debugging.
Use these functions in the following places:
GetSOAPRequest
Clients call this function after the web service request; web service CFCs call this function in the web service CFC method.
GetSOAPResponse
Clients call this function after the web service request completes; web service CFCs cannot use this method.
The following example uses the GetSOAPRequest
and GetSOAPResponse
functions in a web service client:
<cfscript> ws = CreateObject("webservice", "http://localhost:8500/soapexamples/tester.cfc?WSDL"); addSOAPRequestHeader(ws, "http://mynamespace/", "username", "randy"); ret = ws.echo_me("value"); </cfscript> <cfset soapreq = GetSOAPRequest(ws)> <h2>SOAP Request</h2> <cfdump var="#soapreq#"> <cfset soapresp = GetSOAPResponse(ws)> <h2>SOAP Response</h2> <cfdump var="#soapresp#"> ...
The following example uses the GetSOAPRequest
function in a web service CFC method:
<cfcomponent displayName="testerdebug" hint="Test for underscores"> <cffunction access="remote" name="echo_me" output="false" returntype="string" displayname="Echo Test" hint="Header test"> <cfargument name="in_here" required="true" type="string"> <cfset var soapreq = ""> <cfif IsSOAPRequest()> <cfset soapreq = GetSOAPRequest()> <cflog text="#soapreq#" log="APPLICATION" type="Information"> ...
TCPMonitor is a swing-based application that lets you watch the request and response flow of HTTP traffic. You can also watch the request and response flow of SOAP traffic. TCPMonitor replaces the Sniffer service formerly used in Macromedia JRun.
The TCP Monitor main window appears.
TCPMonitor is a swing-based application that lets you watch the request and response flow of HTTP traffic. However, you can also use it to watch the request and response flow of SOAP traffic.
The TCP Monitor main window appears.
Note: In the J2EE configuration, run the utility directly out of the JAR file by using the following command:
java -cp cf_webapp_root/WEB-INF/cfusion/lib/axis.jar java org.apache.axis.utils.tcpmon [listening_port] [target_host] [target_port]
Field | Description |
---|---|
Listen Port# |
Enter a local port number, such as 8123, to monitor for incoming connections. Instead of requesting the usual port on which your server runs, you request this port. TCPMonitor intercepts the request and forwards it to the Target Port. |
Listener |
Select Listener to use TCPMonitor as a sniffer service in JRun. |
Proxy |
Select Proxy to enable proxy support for TCPMonitor. |
Target Hostname |
Enter the target host to which incoming connections are forwarded. For example, if you are monitoring a service running on a local server, the hostname is localhost. |
Target Port# |
Enter the port number on the target machine to which TCPMonitor connects. For example, if you are monitoring a service running on your local ColdFusion server in the server configuration, the default port number is 8500. |
HTTP Proxy Support |
Select this check box only to configure proxy support for TCPMonitor. |
You can optionally specify the Listen Port#, Target Hostname and Target Port# values when invoking TCPMonitor on the command line. The following is the syntax for TCPMonitor:
java org.apache.axis.utils.tcpmon [listening_port] [target_host] [target_port]
A tab appears for your new tunneled connection.
http://localhost:8123/
TCPMonitor displays the current request and response information:
For each connection, the request appears in the Request panel and the response appears in the Response panel. TCPMonitor keeps a log of all request-response pairs and lets you view any particular pair by selecting an entry in the top panel.