cancel
Showing results for 
Search instead for 
Did you mean: 

HttpAdapterException: STATUS_CODE_NOT_OK-Bad Request

Former Member
0 Kudos

Hi all,

I am trying to call Coupa API from a SAP PI 7.3 with SP 07. I am using HTTP_AAE adapter, configuring the URL, port and path. Also I installed public certificates in SAP PI Keystore. I have added a couple of Header Fields we need co communicate to Coupa but the call is not working.

My scenario is ABAP Proxy <-> PI <-> Coupa, and I am executing a proxy empty to retrieve master data from Coupa. I tried to do the API call using SoapUi and is working, just adding the URL and the header fields, but in PI the error is:

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

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

<SAP:P1/>

<SAP:P2/>

<SAP:P3/>

<SAP:P4/>

<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.http.api.HttpAdapterException: STATUS_CODE_NOT_OK-Bad Request</SAP:AdditionalText>

<SAP:Stack/>

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

</SAP:Error>

I have been checking many posts about that, but I don´t know what else we can do, maybe is an SP problem? Whet do you think it could be the problem?

Thanks,

Xavier.

Accepted Solutions (0)

Answers (4)

Answers (4)

nikhil_bose
Active Contributor
0 Kudos

Check your request to the HTTP call. The response is empty because the target is not properly giving back the response. If you can check with the target system about the request they are receiving at their end, would give more tips!

- Nikhil Bose

Former Member
0 Kudos

Hi guys,

I send you an screenshot of the API call to the REST API to get some data, and the raw response. Do I need to add header fields of the response?

Thanks,

Xavier.

iaki_vila
Active Contributor
0 Kudos

Hi Xavier,

You are getting a syntax error. Have you tried not set the query parameters?

Have you tried to enable a trace ?

Regards,

Former Member
0 Kudos

Hi Iñaki,

is it possible to use this trace on HTTP_AAE adapter? I have tried unchecking the query parameters but obtaining the same error of bad request.

In PI 7.3 should I use SOAP (Axis) instead of HTTP_AAE?

Regards,

Xavier.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Xavier,

You can use this blog

This is also applicable for the HTTP AAE, please see the comments section.

Regards,

Mark

iaki_vila
Active Contributor
0 Kudos

Hi Xavier,

The trace functionality is available from PI 7.31 SP014 if you are in PI 7.30 SP07, it may not work with HTTP_AAE 2157425 - New Feature: Client side HTTP Tracing for HTTP_AAE adapter

In your case, you should talk with your your basis team to install the tool TCP gateway, a sniffer that can trace your request from SAP PI. Check Stefan Grube's blog 

Regards.

Former Member
0 Kudos

Hi Iñaki,

finally I tried using Soap Axis to send the API call but I am having the following error:

<?xml version="1.0" encoding="UTF-8" standalone="true"?>

<!-- Inbound Message -->

-<SAP:Error xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SAP="http://sap.com/xi/XI/Message/30" 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.engine.interfaces.messaging.api.exception.MessagingException: java.io.IOException: java.lang.NullPointerException: while trying to invoke the method org.apache.axis.message.SOAPBodyElement.output(org.apache.axis.encoding.SerializationContext) of a null object loaded from local variable 'bodychild'</SAP:AdditionalText>

<SAP:Stack/>

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

</SAP:Error>

I have used some blogs I found about how to configure the Axis adapter but still not working, maybe I forget something? I attach some screenshots about the configuration.

At TserverLocation is added the URL of the API and also parameters for Headers, maybe some parameter need to be different?

Thanks,

Xavier.

iaki_vila
Active Contributor
0 Kudos

Hi Xavier,

Have you set the value of your variables with DynamicConfiguration at mapping level like this document shows http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b092777b-ee47-2a10-17b3-c5f593809...?

And not forget to check before your AXIS installation with http://piHost:50000/XIAxisAdapter/MessageServlet

Regards.

Former Member
0 Kudos

Thanks Iñaki,

finally I achieved to communicate to Coupa. I did a mistake on the Dynamic Configuration parameters. I also used the Keep Attachments option with Payload Extraction as SOAP Body Child.

Thanks,

Xavier.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Xavier,

Can you paste the raw screenshot of a successful request from SOAP UI?

Regards,

Mark

nitindeshpande
Active Contributor
0 Kudos

Hi Xavier,

If it is working with SOAPUI then most probably the API is expecting SOAP envelope. Can you please try sending the data using SOAP adapter? This should work.

If you are on 7.31 SP 13 and above, then i would suggest you to use REST adapter for this request.

Regards,

Nitin

Former Member
0 Kudos

Hi Nitin,

I am on SAP PI 7.3. Could be possible to use HTTP_AAE to call the API or I have to use SOAP(Axis)? Where in SOAP(Axis) are the Header Fields to do the API call?

Regards,

Xavier.