Hi guys
I've written a piece of code to upload a file to a REST-service using the new HttpHeaderBuilder classes. This works fine on 11.7.3. The file is uploaded correctly; we use this in production with multiple customers.
However, when I run the exact same code on a slightly older OpenEdge version, 11.6.3.022, it returns a 504 Gateway Timeout error after 1 minute.
I can't find any clues on the Knowledge Base, so I'm hoping someone has some pointers for me because I'm a bit los for now :-)
See this snippet below to see the simplified structure of the code,
assign oMultiEntity = new MultipartEntity()
oMultiEntity:Boundary = guid
oAttachment = new OpenEdge.Core.Memptr(ipFileContent)
oPart = new OpenEdge.Net.MessagePart('application/octet-stream':U, oAttachment)
oPart:ContentId = 'filedata':U
cUrl = 'https://':U + cHost + '/api/attachments?id=':U + cId.
oPart:Headers:Put(HttpHeaderBuilder:Build('Content-Disposition':U)
:Value('form-data; name="filedata"; filename="':U + ipFileName + '"':U)
:Header).
oMultiEntity:AddPart(oPart).
oRequest = RequestBuilder:Post(cUrl, oMultiEntity)
:AddHeader('Content-Type':U, 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW2':U)
:Request.
oResponse = ClientBuilder:Build():Client:Execute(oRequest).
// After 1 minute i get back a 504 - Gateway Timeout on OpenEdge 11.6.3.022, but on OpenEdge 11.7.3 everything works fine
Hi Peter
It took me a while, but i have the tracing. The request body looks good. After one minute, the response is an empty file. This is the relevant logging. I; ve replaced the actuel host with <HOST>.
"[19/03/01@12:57:52.335+0100] P-002162 T-226215744 1 AS -- (Procedure: 'sys/apps/mtcouploadattachment.p' Line:345) https://<HOST>/v1/attachments?ddName=h49g5efg6Yu2uk858_purchaseInvoice&externalId=12345&fieldName=attachment&environmentId=ENV001&actionType=replace"
"[19/03/01@12:57:52.38 4+0100] P-002162 T-226215744 1 AS HTTPCLIB REQUEST: FILE= /v1/temp/request-raw.txt"
"[19/03/01@12:57:52.386+0100] P-002162 T-226215744 1 AS HTTPCLIB RESPONSE: FILE= /v1/temp/response-data-received.txt"
"[19/03/01@12:57:52.386+0100] P-002162 T-226215744 1 AS SOCKET CONNECT: -H app.bizzstream.com -S 443 -ssl "
"[19/03/01@12:57:52.474+0100] P-002162 T-226215744 1 AS SOCKET CONNECT: TIME(ms)=87"
"[19/03/01@12:57:52.932+0100] P-002162 T-226215744 1 AS SOCKET WRITE: TIME(ms)=456"
"[19/03/01@12:57:52.932+0100] P-002162 T-226215744 1 AS SOCKET WRITE: SIZE(b)=463727"
ONE MINUTE TIME OUT ......
"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS SOCKET READ: AVAIL(b)=500"
"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS SOCKET READ: TIME(ms)=0"
"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS SOCKET READ: SIZE(b)=500"
"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS HTTPCLIB CHUNK: NUM= 1"
"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS HTTPCLIB CHUNK: SIZE(b)= 8192"
"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS HTTPCLIB CHUNK: READ(b)= 500"
"[19/03/01@12:58:53.316+0100] P-002162 T-226215744 1 AS SOCKET READ: COMPLETE= yes"
"[19/03/01@12:58:53.316+0100] P-002162 T-226215744 1 AS SOCKET READ: ERROR= ?"
"[19/03/01@12:58:53.316+0100] P-002162 T-226215744 1 AS SOCKET READ: TOTAL TIME(ms)=60384"
"[19/03/01@12:58:53.316+0100] P-002162 T-226215744 1 AS SOCKET READ: TOTAL SIZE(b)=500"
"[19/03/01@12:58:53.319+0100] P-002162 T-226215744 1 AS SOCKET DISCONNECT: -H <HOST> -S 443 -ssl "
"[19/03/01@12:58:53.319+0100] P-002162 T-226215744 1 AS -- (Procedure: 'sys/apps/mtcouploadattachment.p' Line:370) 504"
looks like the other end is waiting to get the 463727 bytes of data but you never sent it.
Hi Peter,
I'm a bit stuck with tech support, who wants a reproduction, so we have decided to upgrade the ERP system to a newer version, which is shipped with 11.7.3
I haven't seen this issue on 11.7.3, so I'm hoping that the problem goes away after upgrading.
After migrating to OpenEdge 11.7.3 the problem disappeared strangely enough. The exact same code worked fine.