// create a test synapse context
SynapseConfiguration testConfig = new SynapseConfiguration();
org.apache.axis2.context.MessageContext inContext =
new org.apache.axis2.context.MessageContext();
Axis2MessageContext synCtx = new Axis2MessageContext(inContext, testConfig, null);
testConfig.setRegistry(new SimpleURLRegistry());
if (props != null) {
Iterator iter = props.keySet().iterator();
while (iter.hasNext()) {
String key = (String) iter.next();
testConfig.addEntry(key, (Entry) props.get(key));
}
}
synCtx.setConfiguration(testConfig);
SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
OMDocument omDoc = OMAbstractFactory.getSOAP11Factory().createOMDocument();
omDoc.addChild(envelope);
XMLStreamReader parser = XMLInputFactory.newInstance().
createXMLStreamReader(new StringReader(bodyText));
StAXOMBuilder builder = new StAXOMBuilder(parser);
// set a dummy static message
envelope.getBody().addChild(builder.getDocumentElement());
synCtx.setEnvelope(envelope);
return synCtx;
}