Topic
  • 7 replies
  • Latest Post - ‏2013-02-15T09:37:44Z by SystemAdmin
SystemAdmin
SystemAdmin
6089 Posts

Pinned topic Handling Un-Modelled Faults in ESB Mediation

‏2007-06-15T12:01:01Z |
Hello,
I'm trying to find out how to handle the so called "Un-Modelled" faults in the ESB mediation.

[b][u]SCENARIO:[/u][/b]

I have

(a) An import(With webservice bining) of a webservice with one Req-Resp operation and NO WSDL fault defined.

(b) An ESB Mediation which does not a lot but just Logging. (Is simply a pass through mediation).

(c) An Export(With webservice bining) to the Mediation (specified above in (b).

I use SOAP UI or TCP Mon to invoke the webservice exposed by the Export(c).

If the operation is successful I get right response back.

[b][u]PROBLEM:[/u][/b]

When the Webservice (represented by Import(a)) fails I get SOAP Fault in the Mediation. I want to send this fault all the way through to the invoking client.
But since the WSDL FAULT is not defined in the interface, All I get in response is a SOAP Fault BUT with the "ServiceRuntimeException" (see example below)

code

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.generalException</faultcode>
<faultstring>WSWS3035E: Error: com.ibm.wsspi.sca.webservice.jaxrpc.ServiceExportHandler.handleResponse threw RuntimeException.</faultstring>
<faultactor>com.ibm.wsspi.sca.webservice.jaxrpc.ServiceExportHandler</faultactor>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

[/code]

[b][u]ALREADY TRIED:[/u][/b]

1) As per the documentaion, I tried to wire the Callout Response's Fail node to the "CustomMediation" premitive and logged it in a file.

2) Used the XSLT premitive on the fail message on the 'ResponseCallout' node and tried to se the SOAPFaultInfo into the target SMO,

3) Tried to throw an exception from the "Custom Mediation" primitive in the mediation flow.

All I get at the client side is a SOAPFault with the "ServiceRuntimeException".

[b][u]QUESTION:[/u][/b]

Is it POSSIBLE to return a SOAP fault to the invoking client with custom message, IF the WSDL FAULT is not defined in an operation?

Any help is much appreciated.

Thanks
Amitesh
Updated on 2013-02-15T09:37:44Z at 2013-02-15T09:37:44Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    6089 Posts

    Re: Handling Un-Modelled Faults in ESB Mediation

    ‏2007-06-22T11:01:56Z  
    Hi there,
    I'm surprised , Has nobody come across this problem?
    OR please suggest if I'm doing something wrong?

    Thanks for your help in advance.
    Amitesh

    > Hello,
    > I'm trying to find out how to handle the so called
    > "Un-Modelled" faults in the ESB mediation.
    >
    > [b][u]SCENARIO:[/u][/b]
    >
    > I have
    >
    > (a) An import(With webservice bining) of a webservice
    > with one Req-Resp operation and NO WSDL fault
    > defined.
    >
    > (b) An ESB Mediation which does not a lot but just
    > Logging. (Is simply a pass through mediation).
    >
    > (c) An Export(With webservice bining) to the
    > Mediation (specified above in (b).
    >
    > I use SOAP UI or TCP Mon to invoke the webservice
    > exposed by the Export(c).
    >
    > If the operation is successful I get right response
    > back.
    >
    > [b][u]PROBLEM:[/u][/b]
    >
    > When the Webservice (represented by Import(a)) fails
    > I get SOAP Fault in the Mediation. I want to send
    > this fault all the way through to the invoking
    > client.
    > But since the WSDL FAULT is not defined in the
    > e interface, All I get in response is a SOAP Fault
    > BUT with the "ServiceRuntimeException" (see example
    > below)
    >
    > code
    >
    >
    >
    > <soapenv:Envelope
    > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelop
    > e/"
    > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encodin
    > g/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    >
    > <soapenv:Header/>
    > <soapenv:Body>
    > <soapenv:Fault>
    >
    >
    >
    >
    >
    >
    >
    >
    > <faultcode>soapenv:Server.generalException</faultcode
    > >
    > <faultstring>WSWS3035E: Error:
    > E: Error:
    > com.ibm.wsspi.sca.webservice.jaxrpc.ServiceExportHandl
    > er.handleResponse threw
    > RuntimeException.</faultstring>
    >
    >
    >
    >
    >
    >
    >
    >
    > <faultactor>com.ibm.wsspi.sca.webservice.jaxrpc.Servi
    > ceExportHandler</faultactor>
    > </soapenv:Fault>
    > </soapenv:Body>
    > </soapenv:Envelope>
    >
    >
    >
    > [/code]
    >
    > [b][u]ALREADY TRIED:[/u][/b]
    >
    > 1) As per the documentaion, I tried to wire the
    > Callout Response's Fail node to the "CustomMediation"
    > premitive and logged it in a file.
    >
    > 2) Used the XSLT premitive on the fail message on the
    > 'ResponseCallout' node and tried to se the
    > SOAPFaultInfo into the target SMO,
    >
    > 3) Tried to throw an exception from the "Custom
    > Mediation" primitive in the mediation flow.
    >
    > All I get at the client side is a SOAPFault with the
    > "ServiceRuntimeException".
    >
    > [b][u]QUESTION:[/u][/b]
    >
    > Is it POSSIBLE to return a SOAP fault to the invoking
    > client with custom message, IF the WSDL FAULT is not
    > defined in an operation?
    >
    > Any help is much appreciated.
    >
    > Thanks
    > Amitesh
  • SystemAdmin
    SystemAdmin
    6089 Posts

    Re: Handling Un-Modelled Faults in ESB Mediation

    ‏2007-09-01T07:07:57Z  
    Hi there,
    I'm surprised , Has nobody come across this problem?
    OR please suggest if I'm doing something wrong?

    Thanks for your help in advance.
    Amitesh

    > Hello,
    > I'm trying to find out how to handle the so called
    > "Un-Modelled" faults in the ESB mediation.
    >
    > [b][u]SCENARIO:[/u][/b]
    >
    > I have
    >
    > (a) An import(With webservice bining) of a webservice
    > with one Req-Resp operation and NO WSDL fault
    > defined.
    >
    > (b) An ESB Mediation which does not a lot but just
    > Logging. (Is simply a pass through mediation).
    >
    > (c) An Export(With webservice bining) to the
    > Mediation (specified above in (b).
    >
    > I use SOAP UI or TCP Mon to invoke the webservice
    > exposed by the Export(c).
    >
    > If the operation is successful I get right response
    > back.
    >
    > [b][u]PROBLEM:[/u][/b]
    >
    > When the Webservice (represented by Import(a)) fails
    > I get SOAP Fault in the Mediation. I want to send
    > this fault all the way through to the invoking
    > client.
    > But since the WSDL FAULT is not defined in the
    > e interface, All I get in response is a SOAP Fault
    > BUT with the "ServiceRuntimeException" (see example
    > below)
    >
    > code
    >
    >
    >
    > <soapenv:Envelope
    > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelop
    > e/"
    > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encodin
    > g/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    >
    > <soapenv:Header/>
    > <soapenv:Body>
    > <soapenv:Fault>
    >
    >
    >
    >
    >
    >
    >
    >
    > <faultcode>soapenv:Server.generalException</faultcode
    > >
    > <faultstring>WSWS3035E: Error:
    > E: Error:
    > com.ibm.wsspi.sca.webservice.jaxrpc.ServiceExportHandl
    > er.handleResponse threw
    > RuntimeException.</faultstring>
    >
    >
    >
    >
    >
    >
    >
    >
    > <faultactor>com.ibm.wsspi.sca.webservice.jaxrpc.Servi
    > ceExportHandler</faultactor>
    > </soapenv:Fault>
    > </soapenv:Body>
    > </soapenv:Envelope>
    >
    >
    >
    > [/code]
    >
    > [b][u]ALREADY TRIED:[/u][/b]
    >
    > 1) As per the documentaion, I tried to wire the
    > Callout Response's Fail node to the "CustomMediation"
    > premitive and logged it in a file.
    >
    > 2) Used the XSLT premitive on the fail message on the
    > 'ResponseCallout' node and tried to se the
    > SOAPFaultInfo into the target SMO,
    >
    > 3) Tried to throw an exception from the "Custom
    > Mediation" primitive in the mediation flow.
    >
    > All I get at the client side is a SOAPFault with the
    > "ServiceRuntimeException".
    >
    > [b][u]QUESTION:[/u][/b]
    >
    > Is it POSSIBLE to return a SOAP fault to the invoking
    > client with custom message, IF the WSDL FAULT is not
    > defined in an operation?
    >
    > Any help is much appreciated.
    >
    > Thanks
    > Amitesh
    Hi Amitesh,

    sorry for the late response, just saw your posting. have you already found a solution? i had this problem before and my solution was as follows:

    1. i defined a fault within the WSDL (a modeled fault using a BO with some
    strings that are able to contain the fault information)

    2. then i created a mediation module with a custom mediation on the response
    flow:
    Fail Terminal -> Custom Mediation -> Fault Node (defined in the source
    interface).

    3. the custom mediation extracts the failure string
    (/context/failInfo/failureString) from the SMO and populates a defined
    fault BO which is used in the modeled fault - the modeled fault is than
    catched within an fault handler of an invoke (assuming the mediation module
    is wired to a BPEL process)

    I am not sure if this is a satisfying answer for you since you were looking for solution without a modeled fault. anyway, if you want i can send you the document i have written about the way i solved the problem.

    cheers,
    marco
    mation (Figure 1) is included in the context part of the SMO
  • JanNielsen
    JanNielsen
    51 Posts

    Re: Handling Un-Modelled Faults in ESB Mediation

    ‏2008-04-17T12:50:38Z  
    Hi Amitesh,

    sorry for the late response, just saw your posting. have you already found a solution? i had this problem before and my solution was as follows:

    1. i defined a fault within the WSDL (a modeled fault using a BO with some
    strings that are able to contain the fault information)

    2. then i created a mediation module with a custom mediation on the response
    flow:
    Fail Terminal -> Custom Mediation -> Fault Node (defined in the source
    interface).

    3. the custom mediation extracts the failure string
    (/context/failInfo/failureString) from the SMO and populates a defined
    fault BO which is used in the modeled fault - the modeled fault is than
    catched within an fault handler of an invoke (assuming the mediation module
    is wired to a BPEL process)

    I am not sure if this is a satisfying answer for you since you were looking for solution without a modeled fault. anyway, if you want i can send you the document i have written about the way i solved the problem.

    cheers,
    marco
    mation (Figure 1) is included in the context part of the SMO
    Jeez! I've got this exact same problem.
    I cannot believe that a ESB like this doesn't just propagate the perfectly standardized soap:fault message to the end client.

    And I think this would be a nice thing to do IBM, just propagate the fault!

    My problem is solved because I can get the WSDL guys to insert a Fault element into my exports, and map the failInfo into a created BO with a string, but this is absolutely hideous. I then have to scrape the XML from the real message....This is a pia.

    Jan

    Message was edited by: JanNielsen
    Updated on 2008-04-17T12:50:38Z at 2008-04-17T12:50:38Z by JanNielsen
  • SystemAdmin
    SystemAdmin
    6089 Posts

    Re: Handling Un-Modelled Faults in ESB Mediation

    ‏2008-07-02T12:06:26Z  
    I have the same problem.

    An import receives a soap-fault when invoking a web service.

    
    <soap:Body xmlns:soapenv=
    "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap=
    "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi=
    "http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=
    "http://www.w3.org/2001/XMLSchema"> <soap:Fault> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http:
    //cheese/balls/ns.</faultstring> <detail encodingStyle=
    ""/> </soap:Fault> </soap:Body>
    

    I want to return the elements of that soap-fault unmodified, as an unmodeled fault.

    So far, I've gotten no closer than this:

    1) In the WSDL, define a modeled fault
    2) - In a custom mediation primitive, parse the returned soap-fault (contained in /context/failInfo/failureString) into a data-object.
    - Generate an object corresponding with the type of the modeled fault
    - Fill the generated fault-object with data from the object that contains the parsed fault-info.
    - Assign the fault to a body, assign the body to the SMO, and fire out the SMO.

    
    
    
    try 
    { 
    // fault parsen javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance(); javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder(); String soapFault = smo.getContext().getFailInfo().getFailureString(); java.io.ByteArrayInputStream bis = 
    
    new java.io.ByteArrayInputStream (soapFault.getBytes()); org.w3c.dom.Document document = builder.parse(bis);   String faultcode     = 
    ""; String faultstring     = 
    ""; String faultdetail     = 
    ""; String faultactor      = 
    ""; 
    
    try   
    { faultcode = document.getElementsByTagName(
    "faultcode").item(0).getChildNodes().item(0).getNodeValue(); faultstring     = document.getElementsByTagName(
    "faultstring").item(0).getChildNodes().item(0).getNodeValue(); faultdetail   = document.getElementsByTagName(
    "detail").item(0).getChildNodes().item(0).getNodeValue(); faultactor = document.getElementsByTagName(
    "faultactor").item(0).getChildNodes().item(0).getNodeValue(); 
    } 
    
    catch(Exception e) 
    { 
    // bleh 
    }   com.ibm.websphere.sca.ServiceManager serviceManager = 
    
    new com.ibm.websphere.sca.ServiceManager(); com.ibm.websphere.bo.BOFactory bofactory = (com.ibm.websphere.bo.BOFactory)serviceManager.locateService(
    "com/ibm/websphere/bo/BOFactory"); commonj.sdo.DataObject fault = bofactory.create(
    "http://cheese/balls", 
    "genericFault"); fault.setString(
    "faultcode",     faultcode); fault.setString(
    "faultstring",   faultstring); fault.setString(
    "detail",              faultdetail); fault.setString(
    "faultactor",  faultactor); commonj.sdo.DataObject body = (commonj.sdo.DataObject)(smo.getBody()); body.setDataObject(0, fault); smo.setBody(body);   out.fire(smo);     
    } 
    
    catch(Exception e) 
    { e.printStackTrace(); 
    }
    


    This gets me the following result:

    
    <soapenv:Envelope xmlns:soapenv=
    "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc=
    "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=
    "http://www.w3.org/2001/XMLSchema" xmlns:xsi=
    "http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header/> <soapenv:Body> <soapenv:Fault xmlns:m=
    "http://cheese/balls"> <faultcode>m:genericFault</faultcode> <faultstring>soapenv:Client</faultstring> <detail encodingStyle=
    ""> <fault xsi:type=
    "_1:genericFault" xmlns:_1=
    "http://cheese/balls"> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http:
    //cheese/balls/ns.</faultstring> <faultactor/> <detail/> </fault> </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
    


    As you see, the entire fault object is incorporated into the detail-element of the returned fault.

    What I actually wanted was:

    
    <soapenv:Envelope xmlns:soapenv=
    "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc=
    "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=
    "http://www.w3.org/2001/XMLSchema" xmlns:xsi=
    "http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header/> <soapenv:Body> <soapenv:fault> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http:
    //cheese/balls/ns.</faultstring> <faultactor/> <detail/> </soapenv:fault> </soapenv:Body> </soapenv:Envelope>
    


    Is there any way to either

    A) Pass along the original soap-fault unmodified? or
    B) Generate a custom soap fault as an unmodeled fault to return via the export?

    Thank you in advance for your response,

    Nout

    Message was edited by: Gralgrathor
    Updated on 2008-07-02T12:06:26Z at 2008-07-02T12:06:26Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    6089 Posts

    Re: Handling Un-Modelled Faults in ESB Mediation

    ‏2008-07-02T14:16:55Z  
    I have the same problem.

    An import receives a soap-fault when invoking a web service.

    <pre class="jive-pre"> <soap:Body xmlns:soapenv= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd= "http://www.w3.org/2001/XMLSchema"> <soap:Fault> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http: //cheese/balls/ns.</faultstring> <detail encodingStyle= ""/> </soap:Fault> </soap:Body> </pre>
    I want to return the elements of that soap-fault unmodified, as an unmodeled fault.

    So far, I've gotten no closer than this:

    1) In the WSDL, define a modeled fault
    2) - In a custom mediation primitive, parse the returned soap-fault (contained in /context/failInfo/failureString) into a data-object.
    - Generate an object corresponding with the type of the modeled fault
    - Fill the generated fault-object with data from the object that contains the parsed fault-info.
    - Assign the fault to a body, assign the body to the SMO, and fire out the SMO.

    <pre class="jive-pre"> try { // fault parsen javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance(); javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder(); String soapFault = smo.getContext().getFailInfo().getFailureString(); java.io.ByteArrayInputStream bis = new java.io.ByteArrayInputStream (soapFault.getBytes()); org.w3c.dom.Document document = builder.parse(bis); String faultcode = ""; String faultstring = ""; String faultdetail = ""; String faultactor = ""; try { faultcode = document.getElementsByTagName( "faultcode").item(0).getChildNodes().item(0).getNodeValue(); faultstring = document.getElementsByTagName( "faultstring").item(0).getChildNodes().item(0).getNodeValue(); faultdetail = document.getElementsByTagName( "detail").item(0).getChildNodes().item(0).getNodeValue(); faultactor = document.getElementsByTagName( "faultactor").item(0).getChildNodes().item(0).getNodeValue(); } catch(Exception e) { // bleh } com.ibm.websphere.sca.ServiceManager serviceManager = new com.ibm.websphere.sca.ServiceManager(); com.ibm.websphere.bo.BOFactory bofactory = (com.ibm.websphere.bo.BOFactory)serviceManager.locateService( "com/ibm/websphere/bo/BOFactory"); commonj.sdo.DataObject fault = bofactory.create( "http://cheese/balls", "genericFault"); fault.setString( "faultcode", faultcode); fault.setString( "faultstring", faultstring); fault.setString( "detail", faultdetail); fault.setString( "faultactor", faultactor); commonj.sdo.DataObject body = (commonj.sdo.DataObject)(smo.getBody()); body.setDataObject(0, fault); smo.setBody(body); out.fire(smo); } catch(Exception e) { e.printStackTrace(); } </pre>

    This gets me the following result:

    <pre class="jive-pre"> <soapenv:Envelope xmlns:soapenv= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc= "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header/> <soapenv:Body> <soapenv:Fault xmlns:m= "http://cheese/balls"> <faultcode>m:genericFault</faultcode> <faultstring>soapenv:Client</faultstring> <detail encodingStyle= ""> <fault xsi:type= "_1:genericFault" xmlns:_1= "http://cheese/balls"> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http: //cheese/balls/ns.</faultstring> <faultactor/> <detail/> </fault> </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope> </pre>

    As you see, the entire fault object is incorporated into the detail-element of the returned fault.

    What I actually wanted was:

    <pre class="jive-pre"> <soapenv:Envelope xmlns:soapenv= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc= "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header/> <soapenv:Body> <soapenv:fault> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http: //cheese/balls/ns.</faultstring> <faultactor/> <detail/> </soapenv:fault> </soapenv:Body> </soapenv:Envelope> </pre>

    Is there any way to either

    A) Pass along the original soap-fault unmodified? or
    B) Generate a custom soap fault as an unmodeled fault to return via the export?

    Thank you in advance for your response,

    Nout

    Message was edited by: Gralgrathor
    I think there is a broader question that needs to get asked.

    Why do you need your service to return such a specificly formed error code?
    It smells to me like you want to display the error in the client
    application.. which is pointless because your client won't really care that
    it was a mangled SOAP Envelope that prevented thier business use..

    The pattern that I follow is to do catch-all's for failures and wrap them in
    my own error codes. Ie: Dan00001 means the service I invoked returned an
    exception. I will then stick the failure info in there so that the
    application support person can decrypt the message.

    Also, that SOAPAction exception is a weird one. You invoking .NET or
    something?

    Dan Zrobok -Technical Architect - Perficient
    WID/WPS/WESB Blog: http://blog.danzrobok.com
    <dwforums@us.ibm.com> wrote in message
    news:72394669.1215000228975.JavaMail.wassrvr@ltsgwas010.sby.ibm.com...
    >I have the same problem.
    >
    >
    >
    > An import receives a soap-fault when invoking a web service.
    >
    >
    >
    >
    > soap:Body xmlns:soapenv=
    > "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap=
    > "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi=
    > "http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=
    > "http://www.w3.org/2001/XMLSchema"
    >
    > soapenv:Client
    > Server did not recognize the value of HTTP Header SOAPAction:
    > http: //cheese/balls/ns.
    > detail encodingStyle= ""
    >
    >
    >
    >
    >
    > I want to return the elements of that soap-fault unmodified, as an
    > unmodeled fault.
    >
    >
    >
    > So far, I've gotten no closer than this:
    >
    >
    >
    > 1) In the WSDL, define a modeled fault
    >
    > 2) - In a custom mediation primitive, parse the returned soap-fault
    > (contained in /context/failInfo/failureString) into a data-object.
    >
    > - Generate an object corresponding with the type of the modeled fault
    >
    > - Fill the generated fault-object with data from the object that
    > contains the parsed fault-info.
    >
    > - Assign the fault to a body, assign the body to the SMO, and fire out
    > the SMO.
    >
    >
    >
    >
    > try {
    > // fault parsen
    > javax.xml.parsers.DocumentBuilderFactory factory =
    > javax.xml.parsers.DocumentBuilderFactory.newInstance();
    > javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();
    > String soapFault = smo.getContext().getFailInfo().getFailureString();
    > java.io.ByteArrayInputStream bis = new java.io.ByteArrayInputStream
    > (soapFault.getBytes());
    > org.w3c.dom.Document document = builder.parse(bis);
    >
    > String faultcode = "" ;
    > String faultstring = "" ;
    > String faultdetail = "" ;
    > String faultactor = "" ;
    > try {
    > faultcode = document.getElementsByTagName(
    > "faultcode" ).item(0).getChildNodes().item(0).getNodeValue();
    > faultstring = document.getElementsByTagName(
    > "faultstring" ).item(0).getChildNodes().item(0).getNodeValue();
    > faultdetail = document.getElementsByTagName(
    > "detail" ).item(0).getChildNodes().item(0).getNodeValue();
    > faultactor = document.getElementsByTagName(
    > "faultactor" ).item(0).getChildNodes().item(0).getNodeValue();
    > } catch (Exception e) {
    > // bleh
    > }
    >
    > com.ibm.websphere.sca.ServiceManager serviceManager = new
    > com.ibm.websphere.sca.ServiceManager();
    > com.ibm.websphere.bo.BOFactory bofactory =
    > (com.ibm.websphere.bo.BOFactory)serviceManager.locateService(
    > "com/ibm/websphere/bo/BOFactory" );
    > commonj.sdo.DataObject fault = bofactory.create(
    > "http://cheese/balls" , "genericFault" );
    > fault.setString( "faultcode" , faultcode);
    > fault.setString( "faultstring" , faultstring);
    > fault.setString( "detail" , faultdetail);
    > fault.setString( "faultactor" , faultactor);
    >
    > commonj.sdo.DataObject body = (commonj.sdo.DataObject)(smo.getBody());
    > body.setDataObject(0, fault);
    > smo.setBody(body);
    >
    > out.fire(smo);
    >
    > } catch (Exception e) {
    > e.printStackTrace();
    > }
    >
    >
    > This gets me the following result:
    >
    >
    >
    >
    > soapenv:Envelope xmlns:soapenv=
    > "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc=
    > "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=
    > "http://www.w3.org/2001/XMLSchema" xmlns:xsi=
    > "http://www.w3.org/2001/XMLSchema-instance"
    >
    >
    > soapenv:Fault xmlns:m= "http://cheese/balls"
    > m:genericFault
    > soapenv:Client
    > detail encodingStyle= ""
    > fault xsi:type= "_1:genericFault" xmlns:_1=
    > "http://cheese/balls"
    > soapenv:Client
    > Server did not recognize the value of HTTP Header
    > SOAPAction: http: //cheese/balls/ns.
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > As you see, the entire fault object is incorporated into the
    > detail-element of the returned fault.
    >
    >
    >
    > What I actually wanted was:
    >
    >
    >
    >
    > soapenv:Envelope xmlns:soapenv=
    > "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc=
    > "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=
    > "http://www.w3.org/2001/XMLSchema" xmlns:xsi=
    > "http://www.w3.org/2001/XMLSchema-instance"
    >
    >
    >
    > soapenv:Client
    > Server did not recognize the value of HTTP Header SOAPAction:
    > http: //cheese/balls/ns.
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > Is there any way to either
    >
    >
    >
    > A) Pass along the original soap-fault unmodified? or
    >
    > B) Generate a custom soap fault as an unmodeled fault to return via the
    > export?
    >
    >
    >
    > Thank you in advance for your response,
    >
    >
    >
    > Nout

  • JanNielsen
    JanNielsen
    51 Posts

    Re: Handling Un-Modelled Faults in ESB Mediation

    ‏2008-07-03T13:34:51Z  
    I have the same problem.

    An import receives a soap-fault when invoking a web service.

    <pre class="jive-pre"> <soap:Body xmlns:soapenv= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd= "http://www.w3.org/2001/XMLSchema"> <soap:Fault> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http: //cheese/balls/ns.</faultstring> <detail encodingStyle= ""/> </soap:Fault> </soap:Body> </pre>
    I want to return the elements of that soap-fault unmodified, as an unmodeled fault.

    So far, I've gotten no closer than this:

    1) In the WSDL, define a modeled fault
    2) - In a custom mediation primitive, parse the returned soap-fault (contained in /context/failInfo/failureString) into a data-object.
    - Generate an object corresponding with the type of the modeled fault
    - Fill the generated fault-object with data from the object that contains the parsed fault-info.
    - Assign the fault to a body, assign the body to the SMO, and fire out the SMO.

    <pre class="jive-pre"> try { // fault parsen javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance(); javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder(); String soapFault = smo.getContext().getFailInfo().getFailureString(); java.io.ByteArrayInputStream bis = new java.io.ByteArrayInputStream (soapFault.getBytes()); org.w3c.dom.Document document = builder.parse(bis); String faultcode = ""; String faultstring = ""; String faultdetail = ""; String faultactor = ""; try { faultcode = document.getElementsByTagName( "faultcode").item(0).getChildNodes().item(0).getNodeValue(); faultstring = document.getElementsByTagName( "faultstring").item(0).getChildNodes().item(0).getNodeValue(); faultdetail = document.getElementsByTagName( "detail").item(0).getChildNodes().item(0).getNodeValue(); faultactor = document.getElementsByTagName( "faultactor").item(0).getChildNodes().item(0).getNodeValue(); } catch(Exception e) { // bleh } com.ibm.websphere.sca.ServiceManager serviceManager = new com.ibm.websphere.sca.ServiceManager(); com.ibm.websphere.bo.BOFactory bofactory = (com.ibm.websphere.bo.BOFactory)serviceManager.locateService( "com/ibm/websphere/bo/BOFactory"); commonj.sdo.DataObject fault = bofactory.create( "http://cheese/balls", "genericFault"); fault.setString( "faultcode", faultcode); fault.setString( "faultstring", faultstring); fault.setString( "detail", faultdetail); fault.setString( "faultactor", faultactor); commonj.sdo.DataObject body = (commonj.sdo.DataObject)(smo.getBody()); body.setDataObject(0, fault); smo.setBody(body); out.fire(smo); } catch(Exception e) { e.printStackTrace(); } </pre>

    This gets me the following result:

    <pre class="jive-pre"> <soapenv:Envelope xmlns:soapenv= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc= "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header/> <soapenv:Body> <soapenv:Fault xmlns:m= "http://cheese/balls"> <faultcode>m:genericFault</faultcode> <faultstring>soapenv:Client</faultstring> <detail encodingStyle= ""> <fault xsi:type= "_1:genericFault" xmlns:_1= "http://cheese/balls"> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http: //cheese/balls/ns.</faultstring> <faultactor/> <detail/> </fault> </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope> </pre>

    As you see, the entire fault object is incorporated into the detail-element of the returned fault.

    What I actually wanted was:

    <pre class="jive-pre"> <soapenv:Envelope xmlns:soapenv= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc= "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header/> <soapenv:Body> <soapenv:fault> <faultcode>soapenv:Client</faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http: //cheese/balls/ns.</faultstring> <faultactor/> <detail/> </soapenv:fault> </soapenv:Body> </soapenv:Envelope> </pre>

    Is there any way to either

    A) Pass along the original soap-fault unmodified? or
    B) Generate a custom soap fault as an unmodeled fault to return via the export?

    Thank you in advance for your response,

    Nout

    Message was edited by: Gralgrathor
    Hi Gralgrathor

    I've been discussing this with an IBM consultant, and had the answer, "it's not possible, because it could be any kind of error type."
    Apparently the ESB primitive fail terminal can give exceptions of any type, and it's too complicated to figure out if this error comes from a ws fault.

    The WSDL specification says something about user defined errors being put into the detail element.

    I think your solution is ok, allthough I made it a little bit different, using just a BO i created myself.

    J
  • SystemAdmin
    SystemAdmin
    6089 Posts

    Re: Handling Un-Modelled Faults in ESB Mediation

    ‏2013-02-15T09:37:44Z  
    Oh dear, couple years later and the problem in setting SOAPFaultInfo still exists. Whenever I set SOAPFaultInfo, the WebSphere ESB reset it to some stupid message.

    E.g.:

    My settings
    </SMOHeader>
    <SOAPFaultInfo>
    <faultcode xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">ns0:Server</faultcode>
    <faultstring>javax.resource.spi.CommException: The adapter could not get a connection to Email Server. The EIS instance may be down or the specified connection property values may be incorrect.<
    /faultstring>
    </SOAPFaultInfo>

    Returned to web service client

    <soapenv:Fault xmlns:m="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>m:Server</faultcode>
    <faultstring>BusinessObject@726c726c | Name= notification_fault | XSTypeDefinition= {http://lsb.ing.cz/CustomerNotification_002/}msgFault] | Internal Information =[ element {}notification_fault (: state:STATE_{ALL_PRECEDING_RESOLVED|ATTRIBUTES_RESOLVED|FOLLOWING_RESOLVED|NAMESPACE_NODES_RESOLVED|DIRTY|STATE_NODES_REORDERED|ALLOW_FAST_ACCESS} [bitset=4332259] :) (: user data:com.ibm.xml.sdo.model.mediator.FastAccessDataFactory$FastAccessData{No original node | com.ibm.xml.sdo.model.mediator.FastAccessMediator@72787278} :) | nodeID=-2 | subtreeID=null | CacheManager=com.ibm.xml.sdo.model.SDOCacheManager@73aa73aa | JVM Object info=com.ibm.ws.box.bomodel.impl.BusinessObjectImpl@726c726c
    ]</faultstring>