Simple custom SOAP Processor Example - Echo a soap request message

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.

Hey Mark,

Thanks a bunch for that Java based custom soap processor! I m now getting new ideas!!
First, I will try the exact same impl on the local IS server and then let my ideas rule!

Thanks a bunch again!

Cheers
G

Mark,

Out of curiosity… from just looking at this Java service, it appears to me that the same may be done with a Flow service. Is there a reason why a Flow service could not be used here?

Thanks,
Percio

When I posted this example, I was exploring converting my custom soap processor implementation to java using some of the private classes for WM soap messages.

The purpose of sharing it was just to show that a soap processor could be built in java and to show one of the private classes that could be used.

Yes, it could be built in Flow as well.

Mark

Thanks.

Mark,

Thanks for your sticky at [url]wmusers.com

Has WM implemented this out of the box yet? In some other posts I read Q1-Q2 of 2007.

I do have more questions evaluating IS as an ESB. Would this be the appropriate forum to post them.

Regards,
Radu.

IS 7.1 will have a new component called a web services desriptor that will include much of the functionality of my custom soap processor design. We’ll all have to wait until Summer 2007 to find out more.

Sure, you can post your IS as ESB questions here.

Mark