Create Custom SOAPFault

Hi All,

I am currently working on a Flow Service which is accessed from another webMethods Integration Server as a Web Service using SOAP Http method.

I am able to generate response for Success scenarios and send it back to the calling program.

Now I need to send SOAP Fault when there is a Business exception. I am not able to add the SOAP Fault element to the SOAP Body element.

I searched the forum but am not getting a lead.

I am attaching the code. Please correct me if I am doing something wrong.

Send me some samples if you have created one for your project. This would be of great help to me.

Thanks and regards,
Pazhanikanthan. P

Send SMS folder
SendSMS.zip (13.0 k)

Here are the basic steps:

  1. Populate the SOAP-ENV:Fault document using the desired custom values(you can find the structure of this document in any generated WebServiceConnector).
  2. Convert the document to an XML String using pub.xml:documentToString
  3. Convert the xmldata to an xmlnode using pub.xml:xmlStringToXMLNode
  4. Create an empty soap document using pub.soap.utils:createSoapData
  5. Add the node as a body entry using pub.soap.utils:addBodyEntry
  6. Map the result to the soapResponseData object
  7. Cleanup the pipeline so that only soapResponseData remains
  8. Use the pub.flow:setResponse to set the HTTP response to soapResponseData
  9. Use the pub.flow:setResponseCode to set the HTTP return code to “500”

Mark

Mark,
If I have read the SOAP 1.1 Spec correctly it requires the SOAP fault message be returned with an HTTP 500 error. I have been able to create a custom SOAP fault message and leave it in the pipeline so the calling application can read it but as far as I can tell the only way to send an HTTP 500 error back is by throwing an error in the custom SOAP processor by invoking the “Exit ‘$flow’ and signal FAILURE”. If I signal failure then the custom SOAP processor generates it’s own SOAP fault message and the best I can do is pass an error text into the Exit step. Am I missing something here?

Thanks in advance,
Matt

Matt,

Great questions. I’m not sure when it was introduced, but in IS 6.5 you can use the pub.flow:setResponseCode built-in service to do this.

HTH,

Mark

I spent 8 hours trying to get a http status code of 500 on my custom soap faults.

I really wish that they would include the calls to pub.flow:setResponse and pub.flow:setResponseCode in the SOAP developers guide, would have saved me a day!

Of course, if you’d checked here on wMUsers first you would have found that info in no time. :slight_smile:

Could you please let me know if there is any alternative for pub.flow:setResponseCode as i’m using IS 6.1