boolean setService)
throws AxisFault, SAXException
{
// Create the message context
MessageContext msgContext = new MessageContext(engine);
// Set the dispatch either by SOAPAction or methodNS
String methodNS = "urn:dont.match.me";
if (setService) {
msgContext.setTargetService(SOAPAction);
} else {
methodNS = SOAPAction;
}
String bodyElemHead = "<m:" + method + " xmlns:m=\"" +
methodNS + "\">";
String bodyElemFoot = "</m:" + method + ">";
// Construct the soap request
String msgStr = header + bodyElemHead + bodyStr +
bodyElemFoot + footer;
msgContext.setRequestMessage(new Message(msgStr));
msgContext.setTypeMappingRegistry(engine.getTypeMappingRegistry());
// Invoke the Axis engine
try {
engine.invoke(msgContext);
} catch (AxisFault af) {
return af;
}
// Extract the response Envelope
Message message = msgContext.getResponseMessage();
assertNotNull("Response message was null!", message);
SOAPEnvelope envelope = (SOAPEnvelope)message.getSOAPEnvelope();
assertNotNull("SOAP envelope was null", envelope);
// Extract the body from the envelope