Why does SOAP Message Handler create an empty soapResponseData object?

On receipt of a SOAP request (SOAP-MSG) the SOAP Message Handler created two objects - soapRequestData (which contains the SOAP Request) and an “empty” soapResponseData. Wanted to know what is the reason for this “empty” object? It could have very well made it mandatory for the SOAP Processor or the Target Service to create and return a filled soapResponseData object.

Based on my pure logic, I feel:

When a SOAP Client (say XML Spy) sends a SOAP Request it is waiting for a response.

The SOAP Handler creates two SOAP Objects - soapRequestData and soapResponseData - and passes them to the SOAP Processor. While the soapRequestData contains the actual SOAP Rqst, the soapResponseData is “empty”.

This may be a “fail-safe” way to ensure that a SOAP Response Object is instantiated way before the SOAP Processor starts. This will ensure that even if any exception occurs in the SOAP Processor (before it got instantiated in the SOAP Processor or the target service - if we had to do it) there would be no instance of the SOAP Response Object and no SOAP Response contents that the Client was waiting for.

But, since the SOAP Response Object was instantiated by the SOAP Handler much before passing to the SOAP Processor, any error that occured in the SOAP Processor or the target service will be added to the soapResponseData object and passed as a response to the Client.

Any differences??


Is there a practical application that you are considering or is this just a purely theoretical question?

I have not found the inclusion of the soapResponseData object variable in the service specification to affect me in any way other than when I need to create the soapResponse the variable already exists. It still needs to be populated with an empty envelope and meaningful content needs to be added to the envelope before it is useful to the service consumer.


It is a purely theoritical question. Was curious to know why webMethods designed it that way.

Thanks anyway,

Tried deleting the “soapResponseData” object from the input of the target file but it still works. Then what is the need for the SOAP Message Handler to create both soapRequestData and an empty soapResponseData objects? Is my reasoning (above) correct? Can someone throw some light on this pls?

P.S> It is a purely theoritical question