FileDocCategorySizeDatePackage
PlaybackService.javaAPI DocApache Axis 1.42524Sat Apr 22 18:57:28 BST 2006test

PlaybackService

public class PlaybackService extends org.apache.axis.handlers.BasicHandler
A trivial service which simply echoes back a desired SOAP message. This is useful for testing, as we can simulate responses from particular packages, bugs, etc. This should be deployed with provider="Handler".
author
Glen Daniels (gdaniels@apache.org)

Fields Summary
Constructors Summary
Methods Summary
protected java.lang.StringgetFilename(org.apache.axis.MessageContext context)
Get the filename which contains the response message. Looks in the MessageContext/service/engine for a "responseFile" property, and if found simply returns that value. Otherwise defaults to "response.xml" in the current directory of the server. This mechanism can be configured in two ways. First, anyone can set the "responseFile" property based on the message contents, etc. As long as this happens earlier in the handler chain, the value will be picked up and used here. Second, this class can be subclassed and this method overriden to do the right thing.

param
context the current MessageContext
return
the filename containing the canned response

        String filename = context.getStrProp("responseFile");
        if (filename == null) {
            filename = "response.xml";
        }
        return filename;
    
public voidinvoke(org.apache.axis.MessageContext context)

        try {
            FileInputStream stream = new FileInputStream(getFilename(context));
            context.setResponseMessage(new Message(stream));
        } catch (FileNotFoundException e) {
            throw AxisFault.makeFault(e);
        }