cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CPI HTTP Receiver adapter giving error 411 - Length required

YayatiEkbote
Contributor
0 Kudos

Hello experts,

I need to send cXML of Sourcing award confirmation to Ariba Network. When I am sending the cXML via postman to Ariba network directly, it is working. But when I am sending the same through a simple pass through iflow, HTTP receiver adapter, I am getting error - 411 Length required.

Initially I had planned to use Ariba adapter but that doesn't support the ContractStatusUpdateRequest yet as per the response on OSS. So I am trying to find the alternative. So I tried to use simple HTTP receiver adapter and configured necessary paramters. I keep on getting 411 HTTP error. I found that HTTP receiver adapter does not pass content-length header parameter. This is a documented here.

I tried to insert the Content-Length or content-length header parameter using groovy script before end message event. But still getting 411 error. Ariba Network needs this parameter.

Can anyone suggest solution/workaround for this?

Regards,

Yayati Ekbote

Accepted Solutions (1)

Accepted Solutions (1)

YayatiEkbote
Contributor
0 Kudos

Hello guys,

The issue was solved by OSS. It seems that body has to be sent as string type as per the support guy and gave the link of guided answer.

So I implemented a work around groovy script just before the end message event.

def body = message.getBody(java.lang.String);

message.setBody(body);

https://ga.support.sap.com/dtp/viewer/#/tree/2065/actions/26547:26549:28901:28748:41513:41514:41518

And this worked.

I haven't understand the logic behind it 😞 , but for now at least customer issue has been solved.

Regards,

Yayati Ekbote

scar
Employee
Employee
0 Kudos

yayatiekbote

Thanks for your posting! I guess you just send to one cxml to Ariba, How about if we want to send multi-part?

For me we need upload two cxml as attachment. but Ariba always return 411. If I changed to string, then ariba rejected request for it expect multipart.

Anda
Explorer
0 Kudos

Hello,

Did you solve this issue? We have the same requirement, to send a multi form data to SAP Ariba, and it fails due to the missing Content-Length, even though in the trace of CPI it's there.

YayatiEkbote
Contributor
0 Kudos

For MIME multipart message, I wrote a separate logic.

https://blogs.sap.com/2022/01/24/send-cxml-message-to-ariba-network-as-mime-multipart/

Regards,

Yayati

Answers (4)

Answers (4)

RobertJancich
Participant
0 Kudos

Hello yayatiekbote if you suspect lowercase content-length issue, did you try to add them "manually" Capital-case in content modifier as type Header?

Even I am doing something wrong trying it, it pays off reading this

HTTP Receiver Adapter - SAP Help Portal

The HTTP adapter supports only HTTP 1.1. This means that the target system must support chunked transfer encoding and may not rely on the existence of the HTTP Content-Length header.

and also

Request HeadersEnter a list of custom headers, separated by a pipe (|), that you want to send to the target system. Use an * to send all custom headers to the target system. By default, no custom headers are sent.Remember

You must have defined the custom headers in the previous flow steps like content modifiers or scripts before you mention them in the HTTP Receiver Adapter.

All Camel-specific headers (that starts with camel or org.apache.camel) and the below listed HTTP protocol headers are excluded even if you specify them.
  • content-length
  • ...
Sriprasadsbhat
Active Contributor
0 Kudos

Hello Yayati,

Could you please check in Postman console what headers are being sent while you are posting confirmation and try to send same in SAP CPI HTTP adapter.

Regards,

Sriprasad S Bhat

YayatiEkbote
Contributor
0 Kudos

I added Content-Type, Accept etc.. and I can see them all in trace log till HTTP receiver adapter. But still same issue. It is still crying for 411 (Length required issue).

One thing I am suspecting is, Postman has Content-Length with 'C' and 'L' in caps where as CPI is converting it automatically to content-length (all in lower case). Not sure if Ariba is expecting it as 'Content-Length' and unable to understand 'content-length'.

Anyway, I have raised OSS to SAP in parallel. But still I am welcome to suggestions and ideas.

Regards,

Yayati Ekbote

YayatiEkbote
Contributor
0 Kudos

Hello sriprasad.shivarambhat,

Thanks for quick response but can you explain in detail about whitelisting in receiver channel?

Please find attached screenshots of my config -

content length can be seen at receiver step -

But still getting error -

Regards,

Yayati Ekbote

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Yayati,

After adding this in content modifier make sure it is whitelisted in HTTP receiver adapter Request Headers also.

Regards,

Sriprasad Shivaram Bhat