In early testing efforts it is sometimes useful to provide a simple URL that will always echo the soap request message back to the sender.
This very small java service can be registered as a soap processor to do just that:
[highlight=java]
//Note: Add com.wm.app.b2b.server.SOAPMessage to the “Imports” list on your java service’s “Shared” tab
IDataCursor idc = pipeline.getCursor();
//create two new com.wm.app.b2b.server.SOAPMessage objects to hold the soapRequestData and soapResponseData
SOAPMessage request = new SOAPMessage();
SOAPMessage response = new SOAPMessage();
//get the soapRequestData object from the pipeline and throw exception if not present
if (idc.first(“soapRequestData”)) {
request = (SOAPMessage)idc.getValue();
} else {
throw new ServiceException(“Error: Missing SOAP Request!”);
}
response = request;
idc.insertAfter(“soapResponseData”, response);
idc.destroy();
[/highlight]
Save this java service and then register the service using the pub.soap.processor:registerProcessors built-in service. Specify “echo” for the “directive” parameter and specify the fully qualified name of the java service as the “svcName” parameter.
You can confirm that your custom soap processor is registered using the pub.soap.processor:list built-in service.
Once this echoing SOAP processor is registered any SOAP request posted to http://hostname:port/soap/echo will be returned as the soap response.
Note: This example makes use of internal, non-documented classes that may change in subsequent releases.