cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP: TEXT/HTML - how do we track Server response auth errors?

Former Member
0 Kudos

I am calling a web service synchronously from XI, and am getting the standard error back that indicates that the response to my SOAP message is in HTML. i.e..

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIAdapterFramework</SAP:Category>

<SAP:Code area="MESSAGE">GENERAL</SAP:Code>

<SAP:P1 />

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: invalid content type for SOAP: TEXT/HTML</SAP:AdditionalText>

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

Now I'm thinking that this isn't the end of the world, because it is probably a response from the web service's server telling me that I have got the user password wrong (HTTP 401 error).

And indeed, if I go to the communication channel for my SOAP receiver, I can select the "Do Not Use SOAP Envelope" option - and sure enough if I run it again, I get the following:

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="HTTP">ADAPTER.HTTP_EXCEPTION</SAP:Code>

<SAP:P1 />

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>HTTP 401 Unauthorized</SAP:AdditionalText>

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

This indicates that the server was indeed trying to send me an HTML error back but I was expecting a SOAP message.

But I can't just leave "Do Not Use SOAP Envelope" set to "checked", as the outgoing message is not SOAP formatted. The webservice is expecting SOAP and replies back to me with:

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="HTTP">ADAPTER.HTTP_EXCEPTION</SAP:Code>

<SAP:P1 />

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>HTTP 415 Unsupported Media Type</SAP:AdditionalText>

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

.. which is fair enough considering what I am sending it.

So ... I have to leave the "Do Not Use SOAP Envelope" option unchecked to get the message through. If username/password is correct and I have the URL etc specified correctly, then we have no problem.

If, however, username/password is incorrect or changed on the server side then we will get back the ambiguous message:

"com.sap.aii.af.ra.ms.api.DeliveryException: invalid content type for SOAP: TEXT/HTML"

which all it tells us is that there is an HTML error message coming back, but we can't decipher it as we are expecting SOAP.

Surely there is a better way to accept an HTML message than this?

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

Hi Nek,

the error code 415 Unsupported Media Type appears as the SOAP adapter changes the content type from application/xml (for SOAP mode) to text/xml (for non-SOAP mode).

You can use the adapter module <i>MessageTransformBean</i> to change the content type back to application/xml. With the same module you can apply a simple XSLT to build a SOAP envelope for the message in non-SOAP mode.

This should help to receive the error code of the server.

Regards

Stefan

Former Member
0 Kudos

The solution proposed by Stefan looks more elegant, easy and resources-consuming.

Refere to this:

<i>In the sender adapter, you cannot add your own modules.

In the receiver adapter, if you want to add your own modules to process the request message, you add them before the module specified below; if you want to add your own modules to process the response message, you add them after the following module: sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean</i>

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cd/5af7c0c994e24fb0d0088443513de2/frameset.htm">Module Processor</a>

Regards,

Sandro

Answers (1)

Answers (1)

Former Member
0 Kudos

Interesting.

My first though is: use the BPM to send the message, managing the exception so that in case of failure you have an additional SEND STEP that send a test message using HTTP or SOAP without envelop in order to check the response of the remote web server. Than trigger appropriate ALERT CATEGORY putting the value of response.

Regards,

Sandro

Former Member
0 Kudos

Yes thanks Sandro. I thought of that initially, but I was hoping to be able to decipher the original message without having to send another one. Seems bizarre that SAP hasn't catered for this. I guess this is a good work around if all else fails.