com.nsftools.jurst

Class DebugCall


public class DebugCall
extends org.apache.soap.rpc.Call

The DebugCall class is an extension of the Apache SOAP RPC Call class, that provides a little extra functionality that is useful for debugging.

I was really reluctant to write this class, but I did because I wanted an easy way to get the raw XML of the SOAP response that was received, and there didn't seem to be any way without using a sniffer or a proxy of some sort.

I knew that the raw response had to be handled by the Call class somewhere, so I extended that class with this one and modified the invoke method so it stored the XML response internally instead of discarding it. Then I added the getRawSOAPMessage and getRawResponse methods, to provide easy access to the XML that was used for the outgoing SOAP message and the incoming SOAP response for a given Call.

You should be able to use this DebugCall class in place of any Call classes you're using, if you want to try it out.

Apologies to the authors of Apache SOAP for copying and then bastardizing the code for the invoke method. But then again, the wonderful thing about open-source software is that you can do that sort of thing, and add your own functionality as needed.

Version:
0.9.2

Author:
Julian Robichaux

Constructor Summary

DebugCall()
DebugCall(String targetObjectURI, String methodName, Vector params, Header header, String encodingStyleURI)
DebugCall(String targetObjectURI, String methodName, Vector params, Header header, String encodingStyleURI, SOAPContext ctx)

Method Summary

String
getRawResponse()
If the invoke method has already been called, this will return the SOAP response that was returned, as raw XML text.
String
getRawSOAPMessage()
Get the XML text of the raw SOAP message that would be generated by this call, based on the parameters and information you've passed so far.
Response
invoke(URL url, String SOAPActionURI)
This does the same thing as the invoke method in the parent Call class does, with some additional internal code that captures and stores the XML text of the SOAP response, if possible.

Constructor Details

DebugCall

public DebugCall()


DebugCall

public DebugCall(String targetObjectURI,
                 String methodName,
                 Vector params,
                 Header header,
                 String encodingStyleURI)


DebugCall

public DebugCall(String targetObjectURI,
                 String methodName,
                 Vector params,
                 Header header,
                 String encodingStyleURI,
                 SOAPContext ctx)

Method Details

getRawResponse

public String getRawResponse()
If the invoke method has already been called, this will return the SOAP response that was returned, as raw XML text. It the invoke method hasn't yet been called, you will get an empty String. If the invoke method returned an Exception, you will either get an empty String (if the error happened before or during transmission), or the raw response (if the error occurred while trying to parse the response).

Returns:
the raw XML of a SOAP response, as a String


getRawSOAPMessage

public String getRawSOAPMessage()
Get the XML text of the raw SOAP message that would be generated by this call, based on the parameters and information you've passed so far. If you've just called the invoke method, this should return the same XML SOAP message that was just sent.

Returns:
the raw XML of a SOAP message, as a String


invoke

public Response invoke(URL url,
                       String SOAPActionURI)
            throws SOAPException
This does the same thing as the invoke method in the parent Call class does, with some additional internal code that captures and stores the XML text of the SOAP response, if possible.