cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing SOAP fault message in ECC client proxy

Muniyappan
Active Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

engswee
Active Contributor
0 Kudos

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

Muniyappan
Active Contributor
0 Kudos

Hi Eng Swee,

This is exactly what i am looking for. i will try this.

Regards,

Muni.

Muniyappan
Active Contributor
0 Kudos

Thanks Eng Swee. ABAP team has followed your suggestion. they were able to get custom exception structure.

now web service fault error text is successfully displayed to use as a pop up.

Regards,

Muni.

engswee
Active Contributor
0 Kudos

Great to hear that, Muni. Glad to have been of assistance

Answers (3)

Answers (3)

Former Member
0 Kudos

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.

iaki_vila
Active Contributor
0 Kudos

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.

Muniyappan
Active Contributor
0 Kudos

Hi Inaki,

we are getting SOAP fault message in R/3 side above mentioned message format.

even we tried with PI Fault message format also.

we are not able access the fault message values inside proxy exception class.

Regards,

Muni.

iaki_vila
Active Contributor
0 Kudos

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.

Muniyappan
Active Contributor
0 Kudos

Adding space.