on 02-26-2012 12:16 PM
Hi,
I have a sync proxy to proxy scenario and I have created a fault MT and specified in the outbound and Inbound service interface...
*In Inbound proxy I have the following code--*......
.....
RAISE EXCEPTION TYPE z_cx_test_fault
EXPORTING
standard = l_standard_data.
In the sender side abap code which calls the outbound proxy I have the follwing code -
.....
CATCH cx_ai_system_fault INTO lo_cx_ai_system_fault.
txt = lo_cx_ai_system_fault->get_text( ).
WRITE txt.
CATCH z_cx_test_fault INTO lo_cx_test_fault.
txt = lo_cx_standard_message_fault->get_text( ).
WRITE txt.
CATCH cx_ai_application_fault INTO lo_cx_ai_application_fault.
txt = lo_cx_ai_application_fault->get_text( ).
WRITE txt.
when i test the inbound proxy separately I get the custom fault message properly...
however when i run the proxy to proxy sync scenario and the custom exceptionz_cx_test_fault is raised inside the receiver proxy .......control goes to CATCH cx_ai_application_fault and not CATCH z_cx_test_fault .
I understand that cx_ai_application_fault is the super class of all the exception class but why does control go to its exception handling when a custom exception is raised...
Edited by: hema T on Feb 26, 2012 1:16 PM
Edited by: hema T on Feb 26, 2012 1:17 PM
Hi Hema,
Please check your fault message class name
You may copied the other object fault class name here.
You have to assign the faulty class assosiated to your Proxy class.
RAISE EXCEPTION TYPE z_cx_test_fault
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hema,
You can always try downcasting the more generic exception to an object of your exception type. Try with the following code:
CATCH cx_ai_system_fault INTO lo_cx_ai_system_fault.
lo_cx_test_fault ?= lo_cx_ai_system_fault.
IF sy-subrc = 0.
txt = lo_cx_test_fault->get_text( ).
ELSE.
txt = lo_cx_ai_system_fault->get_text( ).
ENDIF.
WRITE txt.
I have also just spotted an error in your initial code:
CATCH z_cx_test_fault INTO lo_cx_test_fault.
txt = lo_cx_standard_message_fault ->get_text( ).
You use different error object than the one you catch the error into (bolded above).
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi experts,
I actually did not activate the fault class and hence the problem .....now the control is going to my custom catch block but it is not writing the custom ( fault detail /fault text message ) ....but it is only writing the text - "application error" why is that so??
CATCH z_cx_test_fault INTO lo_cx_test_fault.
txt = lo_cx_test_fault->get_text( ).
WRITE txt
Hello Hema,
I have the similar issue of not getting the fault in my custom class. I am still struggling for the resolution.
However, I do have answer for you since you are now getting the fault in your custom fault class. In you custom fault class 'Attributes' you should notice a table called 'STANDARD'. The actual error message from the proxy is returned in this table. Read this table and you should get the actual error message. GET_TEXT( ) or GET_LONGTEXT( ) will not work here.
Do let me know how you resolved the custom fault class issue
Thank you.
Sud..
Hi Hema,
Try changing the sequence of the CATCH blocks, so that the block for your custom z_cx_test_fault exception was before the standard one. I think this might solve your problem. Most probably the sequence does matter when catching the exception, and the reason for your strange behaviour is that SAP only goes into the first CATCH block on the list that matches the type of the error raised (not ALL of the matching CATCH blocks, which is what you expect I think).
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I tried changing the sequence also but it did not work...
I can see an appropriate response coming from the receiver in SXMB_MONI of PI...this response has the "fault response "
"fault detail" data that I want.....however when the control goes to the sender why does it go to CATCH CX_AI_APPLICATION_FAULT and not not my CATCH z_cx_test_fault .
My observation - If I change the scenario to SOAP to Proxy sync..then the sender SOAP client gets the appropriate custom fault message back.
Edited by: hema T on Feb 27, 2012 1:17 PM
Edited by: hema T on Feb 27, 2012 1:17 PM
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.