cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Webservice returning HTML response instead of SOAP

Former Member
0 Kudos

<br>Hi,

I want to call a webservice created from an SAP function in SAP 6.40.

When I test this webservice with the TCPGateway tool, if no application exception occured, I receive the correct response : the <b>SOAP</b> response message:


<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Body>
      <n0:ZWsCreateWagonResponse xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
      </n0:ZWsCreateWagonResponse>
   </soap-env:Body>
</soap-env:Envelope>

<br>But if an application exception occured in the web service, I receive the response message in <b>HTML</b> :


500 Internal Server Error
...
Error when processing your request 
What has happened?
The URL .../sap/bc/srt/rfc/sap/z_ws_create_wagon was not called due to an error. 
The following error text was processed in the system LSD : Exception condition "ALREADY_EXISTS" raised. 
The termination type was: RABAX_STATE
The ABAP call stack was: 
Function: Z_WS_CREATE_WAGON of program SAPLZ_WS_HU
Form: EXECUTE of program CL_SRG_RFC_PROXY_CONTEXT ---- CP
Form: IF_SOAP_APPLICATION_RT EXEC_PROCESSING of program CL_SOAP_APPLICATION_RFC ---- CP
Form: EXEC_PROCESSING of program CL_SOAP_RUNTIME_SERVER ---- CP
Form: EXECUTE_PROCESSING of program CL_SOAP_RUNTIME_ROOT ---- CP
Form: EXECUTE_PROCESSING of program CL_SOAP_RUNTIME_SERVER ---- CP
Form: EXEC_PROCESSING of program CL_SOAP_TRANSPORT_EXTENSN_ROOTCP
Form: EXEC_PROCESSING of program CL_SOAP_HTTP_EXTENSION ---- CP
Form: HANDLE_REQUEST of program CL_SOAP_TRANSPORT_EXTENSN_ROOTCP
Form: HANDLE_REQUEST of program CL_SOAP_HTTP_EXTENSION ---- CP
 ... 

<br>When I call the web service in XI with a SOAP Receiver Adapter, I get the following exception (in case of application exception but also when no application exception occured) :

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

So, my questions:

- how to receive a SOAP response instead of an HTML response in case of application exception in the web service ?

- why do I get an Invalid content type exception when the response is well a SOAP response ?

<br><br>Thanks in advance,

Laurence

Accepted Solutions (0)

Answers (3)

Answers (3)

Shabarish_Nair
Active Contributor
0 Kudos

can you test the WS independently using XML spy ? confirm if it returns a success there.

Ref: /people/siva.maranani/blog/2005/03/01/testing-xi-exposed-web-services

Former Member
0 Kudos

I have not XML Spy but with SOAPSonar all is right :

Response in case of success (the car is well created) :


<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Body>
      <n0:Z_WS_CREATE_WAGONResponse xmlns:n0="urn:sap-com:document:sap:rfc:functions">
      </n0:Z_WS_CREATE_WAGONResponse>
   </soap-env:Body>
</soap-env:Envelope>

Response in case of exception in web service (the car already exists) :

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
 <soap-env:Body>
    <soap-env:Fault>
      <faultcode>soap-env:Client</faultcode>
      <faultstring xml:lang="en">ALREADY_EXISTS</faultstring>
      <detail>
        <n0:Z_WS_CREATE_WAGON.Exception xmlns:n0="urn:sap-com:document:sap:rfc:functions">
          <Name>ALREADY_EXISTS</Name>
          <Text>
          </Text>
        </n0:Z_WS_CREATE_WAGON.Exception>
      </detail>
    </soap-env:Fault>
  </soap-env:Body>
</soap-env:Envelope>

Shabarish_Nair
Active Contributor
0 Kudos

i think u might need to implement fault mesg. in this case.

Ref:

/people/shabarish.vijayakumar/blog/2006/11/02/fault-message-types--a-demo-part-1

/people/varadharajan.krishnasamy/blog/2007/01/09/troubleshooting-soap-message--xi

/people/sap.user72/blog/2006/01/16/xi-propagation-of-meaningful-error-information-to-soap-client

moorthy
Active Contributor
0 Kudos

HI,

Are you giving correct url ?

Go thru this thread discussion-

Hope this helps,

Regards,

Moorthy

Former Member
0 Kudos

Hi,

The purpose of the webservice is to create a car and when I check in SAP, the car is well created, so I'm sure to use the correct url.

I can see the request and response of the webservice via TCP Gateway, and both are correct (both soap messages).

Former Member
0 Kudos

You got HTML because the DUMP in the target system, you can see it from ST22.

You got HTML instead of SOAP because you don't manage this kind of the exception.

In order to manage exception completely you must to use BPM: with the BPM you can include the SEND step in a block and manage the exception sending, for instance, a SOAP in response with the text of the error.

Regards,

Sandro

Former Member
0 Kudos

Thanks for your response, Sandro.

The webservice which I use has been modified. Now if it throws an exception, I receive well a SOAP message :


<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Body>
      <soap-env:Fault>
         <faultcode>soap-env:Client</faultcode>
         <faultstring xml:lang="en">ALREADY_EXISTS</faultstring>
         <detail>
            <n0:Z_WS_CREATE_WAGON.Exception xmlns:n0="urn:sap-com:document:sap:rfc:functions">
               <Name>ALREADY_EXISTS</Name>
               <Text>Virus scan profile /SIHTTP/HTTP_UPLOAD is not active</Text>
               <Message>
                  <ID>VSCAN</ID>
                  <Number>033</Number>
               </Message>
            </n0:Z_WS_CREATE_WAGON.Exception>
         </detail>
      </soap-env:Fault>
   </soap-env:Body>
</soap-env:Envelope>

About the exception managing :<br>

- In my integration process, I include the send step in a block, with property <i>Exceptions</i> =

ALREADY_EXISTS

- In the send step, in property <i>Exceptions</i>, I add <i>System Error</i>

ALREADY_EXISTS

- I insert an <i>Exception Branch</i> in the new block, <i>Exception Handler</i>

ALREADY_EXISTS

Is that correct?

Do I need to use Fault messages?

And how do I get the error message ?

<br>In transaction ST22, I have no dump.

<br>If it is a problem of exception managing, why do I get also the error (<i>com.sap.aii.af.ra.ms.api.DeliveryException: invalid content type for SOAP: TEXT/HTML</i>) when all is right in the web service call ?

Regards,

Laurence