-1

I am currently trying to implement SAP Communication with NODEJS external Service, where SAP sends data via Internet Communication Framework (ICF).

I am able already to send data in plain format. However, I am interested in sending it via chunks. So I setup those two headers:

CALL METHOD server->response->set_header_field
  EXPORTING
    name  = 'Transfer-Encoding'
    value = 'chunked'.

CALL METHOD server->response->set_header_field
  EXPORTING
    name  = 'Content-Type'
    value = 'text/plain'.

And I set response data as indicated in Wikipedia: c_result = '4\r\nWiki\r\n5\r\npedia\r\nE\r\n in\r\n\r\nchunks.\r\n0\r\n\r\n'. server->response->set_cdata( c_result ).

However, when I call it in GW Client, I get error: "HTTP Receive failed: connection to partner broken".

When I call it in my NodeJS external service, I get error:

{ Error: Parse Error
    at Socket.socketOnData (_http_client.js:442:20)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:94:17) bytesParsed: 945, code: 'HPE_INVALID_CHUNK_SIZE' }

Could you please help me to identify where the issue is? I have some suspects:

  1. Either SAP ICF does not support chunks at all
  2. Either I do not setup response correctly
  3. Either response text is being modified additionally in SAP response processing. Is there someone experienced, who could help?
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Denis
  • 167
  • 3
  • 20

1 Answers1

1

I realized in the end, the ICF uses HTTP 1.0, and chunks were added in HTTP 1.1 and retired in HTTP 2.0.

Please let me know if I should delete the question.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Denis
  • 167
  • 3
  • 20
  • The question and answer are useful for future visitors, maybe now that you found the answer, you may generalize the question a little bit so that future visitors can find your post more easily. – Sandra Rossi Aug 18 '20 at 09:41