Topic
  • 4 replies
  • Latest Post - ‏2013-06-30T15:29:36Z by ManishJ
dpbuddies
dpbuddies
14 Posts

Pinned topic Handling soap faults

‏2012-04-16T14:04:46Z |
Hi,
If backend sends soap fault to Datapower how should we handle such soap faults in Datapower.

Note:We also need to send soap fault to consumer.

Thanks
Updated on 2012-05-03T23:47:59Z at 2012-05-03T23:47:59Z by HermannSW
  • swlinn
    swlinn
    1348 Posts

    Re: Handling soap faults

    ‏2012-04-17T03:21:42Z  
    You could pass the soap fault from the backend straight thru to the client, and you could also have a custom stylesheet to create a soap fault in your error rule. Have process backend errors enabled so backend http errors are still processed by your response rule to do the passthru of the fault. If you want to augment this in your error rule, you can check the x-dp-response-code for a string that does not start with 200 and reject the request after placing the returned fault in a context variable. You get this response code via

    <xsl:variable name="respCode" select="normalize-space(dp:response-header('x-dp-response-code'))"/>
    


    You can then build your soap fault and pull in info from the backend fault.

    Regards,
    Steve
    Updated on 2014-03-25T02:57:42Z at 2014-03-25T02:57:42Z by iron-man
  • dpbuddies
    dpbuddies
    14 Posts

    Re: Handling soap faults

    ‏2012-05-03T20:16:32Z  
    • swlinn
    • ‏2012-04-17T03:21:42Z
    You could pass the soap fault from the backend straight thru to the client, and you could also have a custom stylesheet to create a soap fault in your error rule. Have process backend errors enabled so backend http errors are still processed by your response rule to do the passthru of the fault. If you want to augment this in your error rule, you can check the x-dp-response-code for a string that does not start with 200 and reject the request after placing the returned fault in a context variable. You get this response code via

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr"><xsl:variable name="respCode" select="normalize-space(dp:response-header('x-dp-response-code'))"/> </pre>

    You can then build your soap fault and pull in info from the backend fault.

    Regards,
    Steve
    Thanks For Response.Do we need to mention fault code,Fault Actor and Fault string in WSDL which are generated in Soap Fault?.Is it mandatory?
  • HermannSW
    HermannSW
    4654 Posts

    Re: Handling soap faults

    ‏2012-05-03T23:47:59Z  
    • dpbuddies
    • ‏2012-05-03T20:16:32Z
    Thanks For Response.Do we need to mention fault code,Fault Actor and Fault string in WSDL which are generated in Soap Fault?.Is it mandatory?
    > Thanks For Response.Do we need to mention fault code,Fault Actor and Fault string in WSDL which are generated in Soap Fault?.Is it mandatory?

    Depending on the backend SOAP encoding (1.1 or 1.2) please lookup store:///schemas/soap-envelope-1.x.xsd,
    it will tell you what is required (required="true" or minOccurs>"0") and what is optional (minOccurs="0").
    (minOccurs defaults to "1" if not specified)

     
    Hermann<myXsltBlog/> <myXsltTweets/>
  • ManishJ
    ManishJ
    24 Posts

    Re: Handling soap faults

    ‏2013-06-30T15:29:36Z  
    • swlinn
    • ‏2012-04-17T03:21:42Z
    You could pass the soap fault from the backend straight thru to the client, and you could also have a custom stylesheet to create a soap fault in your error rule. Have process backend errors enabled so backend http errors are still processed by your response rule to do the passthru of the fault. If you want to augment this in your error rule, you can check the x-dp-response-code for a string that does not start with 200 and reject the request after placing the returned fault in a context variable. You get this response code via

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr"><xsl:variable name="respCode" select="normalize-space(dp:response-header('x-dp-response-code'))"/> </pre>

    You can then build your soap fault and pull in info from the backend fault.

    Regards,
    Steve

    Hi Steve

    AS you mentioned that we may setup custom stylesheet to create a soap fault in our error rule.  Do you have any sample xslt code to pass custom soap fault to client and how to use it under error rule?

    I have a requirement to send a custom soap fault to client for couple of error scenarios - a) Schema validation error for request b) backend connection failure c) SLM rejection at front end. I have added a "on error" action at request rule and then setting slm, schema validation. It will invoke another rule (I have created response rule - should I create error rule?). I have created a response rule considering that after transformation result would be directed to service consumer client but it is not going there. I have aded a transformation action which is using xslt to fetch custmer soap fault xml file uploaded in Datapower to sent to  client. XSLT is able to get handle of file but not sending it as a soap fault..

    Would you please advise, if I need to do something to make it a) soap fault response b) pass it to client as response (while request schema validation is not a response from system but as it is a failure in DataPower, cleint want a custom SOAP fault). Please note that request response are SOAP version 1.1 but the custom soap fault does not contain standard 1.1 tags. Is it necessary to have standard tags only? Sample SOAP fault attached.

     

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
        <lc:FaultResponse xmlns:com="http://www.monster.com/cm/common/V3" xmlns:dt="http://www.monster.com/cm/rmDatatypes/V1" xmlns:int="http://www.monster.com/integration/core/V1" xmlns:lc="http://www.monster.com/API/LocalCollect/V0.8" xmlns:rd="http://www.monster.com/cm/referenceData/V2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.monster.com/API/LocalCollect/V0.8 MLSchemaV0_8.xsd ">
          <lc:faultcode>Server</lc:faultcode>
          <lc:faultstring>Unknown Service Error</lc:faultstring>
          <lc:details>
            <code>MB0003</code>
            <name>MB0003</name>
            <description>Service is unavilable due to an unknown reason.</description>
          </lc:details>
        </lc:FaultResponse>
       </soapenv:Body>
    </soapenv:Envelope>

     

    Thanks

    Manish

    Updated on 2013-06-30T17:35:41Z at 2013-06-30T17:35:41Z by ManishJ