Skip to Content

Capturing SOAP fault message in ECC client proxy

Hi All,

I am doing proxy to soap synchronous scenario. we got wsdl from web service. wsdl has request,response and fault message type. Fault message type is a custom one.

we are not using standard Fault Messages (SAP Library - Web Services).

Whenever application error happens web service is sending the fault message to ECC. I am able to see the fault message payload in PI and ECC

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Exception>

<errorCode>1</errorCode>

<errorText>record does not exist</errorText>

</ns0::Exception>

For application error, we want to display errorText to user as a pop up message.But none of the exception methods is getting this errorText from Fault payload.

this Error Handling (SAP Library - Web Services) help link says that application errors can be handled for sync interface.

Can anyone help how to get the errorText value using proxy exception class? any code snippet?

i also tried using standard sap fault message in the sender side and did the mapping(web service fault message-->sap fault message). Still not able to get the value.

Thanks,

Muni

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Apr 22, 2014 at 02:47 AM

    Hi Muni

    Just to confirm - the fault response is making it's way back to the ECC but you are unable to access the fields in the fault message, is that right?

    In the calling program, you will need a TRY-CATCH statement when it executes the proxy. Here's a sample, not everything is syntactically correct, just focus on the CATCH part.

    DATA:
    lo_exception TYPE <YOUR_PROXY_GENERATED_EXCEPTION_CLASS>.
    
    TRY.
    
    object->EXECUTE_SYNCHRONOUS( EXPORTING output = request
                                                            IMPORTING input = response ).
    
    CATCH <YOUR_PROXY_GENERATED_EXCEPTION_CLASS> INTO lo_exception.
    * You can access the fields from LO_EXCEPTION, i.e lo_exception->exception-error_code
    
    * Raise error message
    MESSAGE lo_exception->exception-error_text TYPE 'E'.
    
    ENDTRY.
    
    

    Can't give you the exact coding required as I do not know how the generated proxy class for the exception looks like.

    If you see the screenshots below based on the standard fault message type, you can see the structure is available for access via the instance attributes of the exception.

    Hopefully I understood your issue correctly and this helps.

    Rgds

    Eng Swee


    fault1.png (18.8 kB)
    fault2.png (16.7 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 21, 2014 at 02:43 PM

    Hi Miniyappan,

    Have you tried to capture the SOAP fault message with an XSL mapping to your own error tags?. It isn't a smart solution but it will work if you don't find any better solution.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Muniyappan,

      I mentioned to access to SOAP fault message via XSL and with the check Do Not Use SOAP envelop, in PI, in order to access this data and copy the value in the normal tags in your payload, without ABAP development. As I said before this method works fine for me although this is not an elegant solution, too much workaround. May be, someone had a better way to do it, but in the worst of the cases you can follow the tricky way.

      Regards.

  • Apr 21, 2014 at 02:23 PM

    Adding ABAP Development space.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 05, 2015 at 05:15 PM

    Hi all

    I noticed that I can only catch the cx_ai_application_fault. It almost looks like the client proxy will never raise the custom exception for me to catch.

    However, if I look at sxmb_moni, I can see the errors from the custom exception on the return portion of the sync message. So I think something must have worked.

    If I use soap as the sender instead of ECC, I can see the exception text too from the soapui. Note that the data in the custom exception message type is populated from the exception mapping.

    Has anyone got your custom exception working in a sync interface? Please share your experience if you do.

    Thanks,

    Jonathan.

    Add comment
    10|10000 characters needed characters exceeded