webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Create Custom SOAPFault

    Posted Mon September 26, 2005 06:46 AM

    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)


    #soa
    #webMethods
    #API-Management


  • 2.  RE: Create Custom SOAPFault

    Posted Mon September 26, 2005 10:20 PM

    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


    #soa
    #API-Management
    #webMethods


  • 3.  RE: Create Custom SOAPFault

    Posted Wed May 24, 2006 10:56 PM

    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


    #API-Management
    #webMethods
    #soa


  • 4.  RE: Create Custom SOAPFault

    Posted Wed May 24, 2006 11:29 PM

    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


    #webMethods
    #API-Management
    #soa


  • 5.  RE: Create Custom SOAPFault

    Posted Thu November 09, 2006 03:55 PM

    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!


    #API-Management
    #webMethods
    #soa


  • 6.  RE: Create Custom SOAPFault

    Posted Thu November 09, 2006 05:33 PM

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


    #webMethods
    #soa
    #API-Management


  • 7.  RE: Create Custom SOAPFault

    Posted Tue August 25, 2009 09:38 AM

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


    #soa
    #webMethods
    #API-Management