cancel
Showing results for 
Search instead for 
Did you mean: 

Catch unhandled exception from RFC in PI without BPM

Former Member
0 Kudos

Hi

I have a SOAP - RFC synchronous scenario without using BPM. Now there is one more requirement to handle undhanled exceptions from RFC such as Fatal Error, Dump in CRM etc in PI so that customer can get the idea of what happend in the Backend rather PI failing in the monitoring like session timeout etc. and no clue goes to the customer.

I tried doing it using the Fault Message type of Interfaces and to some extent it worked:

Error response from RFC caught in PI:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP:Header/>
	<SOAP:Body>
		<SOAP:Fault>
			<faultcode>SOAP:Server</faultcode>
			<faultstring>Server Error</faultstring>
			<detail>
				<ns1:mt_test_res xmlns:ns1="http://royalmail.com/wms">Division by 0 (type I)</ns1:mt_test_res>
			</detail>
		</SOAP:Fault>
	</SOAP:Body>
</SOAP:Envelope>

But I dont want <SOAP:Fault>

* <faultcode>SOAP:Server</faultcode>*

* <faultstring>Server Error</faultstring>*etc in the response,

I want that customer gets the message normally in the response structure only rather than any fault message.

eg.

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP:Header/>
	<SOAP:Body>
		<detail>
				<ns1:mt_test_res xmlns:ns1="http://royalmail.com/wms">Division by 0 (type I)</ns1:mt_test_res>
		</detail>
	</SOAP:Body>
</SOAP:Envelope>

Can anybody help me in achieving this.

Thnks

Naina

Accepted Solutions (1)

Accepted Solutions (1)

RKothari
Contributor
0 Kudos

Hello,

Please check the below mentioend blog, it might help you:

/people/venu.v5/blog/2009/08/05/rfcbapi-exceptions-handling-in-sap-netweaver-xi

-Rahul

Former Member
0 Kudos

Hi

I have already done the same mentioned in the blog but the requirement is bit different...i dnt want to show the <Soap Falult> structure ...all i need to show is the error message comes in the normal response structure only.....and it is not happening

Naina

henrique_pinto
Active Contributor
0 Kudos

Hi naina,

the blog is exactly what you need.

It's just that he didn't focus on how he defined the MT_RFC_Exception message type, he used the standard SOAP one.

What Jose Nunes mentioned is that you can change this message type to hide the tags you don't want, in your case.

Alternatively, you could even create a custom mapping (Java or XSLT) and put it in the mapping program list of the interface mapping, after the mappings you already have in place. Then you can map the SOAP fault messsage to whatever you want.

Best regards,

Henrique.

Former Member
0 Kudos

Hi Henrique

I tell you how I did the scenario

1. I have a Non BPM scenario so all i did was in the Interfaces mapping tabs named

REQUEST - RESPONSE - FAULT

Request and Response were the ormal tabs but in the fault tab I added a graphical message mapping.

Now before that I added Fault message type to both sender and receiver interface, say

-> Reciever Interface is MI_TEST_IN so it contains message types

Input Message - ZTEST_1
Output Message - ZTEST_1.Response
Fault Message Type - ZTEST_1.Exception

-> and the Sender Interface MI_TEST_OUT contains:

Output Message -  MT_Test
Input Message -  mt_test_res
Fault Message Type - mt_test_res

In which the Fault Message Type of Sender I exported the Input message and Imported it as a xsd in Fault Message Type.

But when I run the application I still get :

*Request Data*

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<SOAP-ENV:Body>
		<m:MT_Test xmlns:m="http://xxx.com/wms">
			<Test>0</Test>
		</m:MT_Test>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

*Response*

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP:Header/>
	<SOAP:Body>
		<SOAP:Fault>
			<faultcode>SOAP:Server</faultcode>
			<faultstring>Server Error</faultstring>
			<detail>
				<ns1:mt_test_res xmlns:ns1="http://xxx.com/wms">Division by 0 (type I)</ns1:mt_test_res>
			</detail>
		</SOAP:Fault>
	</SOAP:Body>
</SOAP:Envelope>

So I think this <SOAP:Fault>

<faultcode>SOAP:Server</faultcode>

<faultstring>Server Error</faultstring>

</SOAP:Fault>

Comes at the runtime and there is no way to avoid it in order to show the client that the error message is coming in the response and not in any fault message type.

Am i doing it the right way ??

Regards

Naina

Former Member
0 Kudos

Hi

Any updates please...i have to solve this urgently!!

Regards

Naina

former_member182503
Active Contributor
0 Kudos

Naina,

have you tried doing a Java/XSLT mapping to convert the message to the format that you want?

Best regards,

JN

Former Member
0 Kudos

Hi Jose

I thought about that as well but the problem is

SOAP:Fault>
		<faultcode>SOAP:Server</faultcode>
		<faultstring>Server Error</faultstring>

Comes at the run time if i am not wrong so the avove tags will always come even if we use Java Mapping. And if you see below I have already added the response structure in the excpetion response.

<detail>
	<ns1:mt_test_res xmlns:ns1="http://xxx.com/wms">Division by 0 (type I)</ns1:mt_test_res>
</detail>

I expected the response to be like this...i.e. without <Fault tags> so that it will look like Response only and not some other Fautlt structure.

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP:Header/>
	<SOAP:Body>
	                     <detail>
			<ns1:mt_test_res xmlns:ns1="http://xxx.com/wms">Division by 0 (type I)</ns1:mt_test_res>
		</detail>
	</SOAP:Body>
</SOAP:Envelope>

Regards-

Naina

RKothari
Contributor
0 Kudos

Hi,

Can you try the option of Custome adapter module on SOAP channel only for response sent by RFC .

Check if the payload contains the Fault parameters in the response payload:

<SOAP:Fault>

  • <faultcode>SOAP:Server</faultcode>*

  • <faultstring>Server Error</faultstring>*

Remove the fault parameter by replacing them with Null.

Please find below the link, which could be helpful for developing the module:

/people/alessandro.guarneri/blog/2010/08/03/soap-sender-adapter-modules

-Rahul

henrique_pinto
Active Contributor
0 Kudos

From a conceptual perspective, what you're trying to do is encapsulate a Runtime Application Error within the regular Application response, like there was no error.

The point is that this division by 0 exception was never caught in the RFC code, and hence it was thrown as an exception to the caller. If you encapsulate the piece of code which does the division within a TRY block, then catch the exception, you'd be able to return the response normally.

BR,

Henrique.

Former Member
0 Kudos

Hi Henrique

I am doing the same now as the approach i was trying is not working for me

Thanks

Naina

Answers (1)

Answers (1)

former_member182503
Active Contributor
0 Kudos

Hi naina,

You can declare a External Message with the same structure of your regular message and set it as Fault Message. In the Interface Mapping, you can set a message mapping, where you can map the default FaultMessage layout to your External Message layout.

Best Regards,

JN