Error WAIT-FOR terminated. (4123) while doing HTTP POST

Posted by xjg on 03-Nov-2017 14:14

Hello,

I'm working in a program that needs to post some data via a REST API. Specifically, it needs to first post an attachment related with the data being posted (if any) and later to post the actual data.

I use the IHttpRequest, IHttpResponse and IHttpClient to achieve this. 

While it's posting this, I eventually got the following:

None of the widgets used in the WAIT-FOR statement are in a state (such as SENSITIVE) such that the specified event can occur.  WAIT-FOR terminated. (4123)

Run-time error in WAIT-FOR at line 232 (relative to expanded source) of WaitForResponse OpenEdge.Net.ServerConnection.ClientSocket. (3269)

 

The issue comes just when posting the attachment, if I try to post a document that has no attachments related to it, the issue does not appear.

I have the 4GL trace active and the strange part here is that I actually receive an HTTP 201 response when posting the attachment if I check the "response-data-received.txt" file created when the trace is active.

Just as reference, I have something as follows:

/* MULTI PART */

/* Metadata Part */
lvo_AttReqPart = new MessagePart("application/json", lvo_JsonParams).

/* Add metadata part to the entity */
lvo_AttEntity:AddPart(lvo_AttReqPart).

/* File part */
lvo_pdfFile = new Memptr(lv_mData).
lvo_AttReqPart = new MessagePart('application/pdf':u, lvo_pdfFile).

lvo_HdrPart = HttpHeaderBuilder:Build('Content-Disposition':u)
:Value(substitute('attachment; filename=&1':u, quoter(ipc_file)))
:Header.
lvo_AttReqPart:Headers:Put(lvo_HdrPart).

/* Add metadata part to the entity */
lvo_AttEntity:AddPart(lvo_AttReqPart).

/* POST the attachments */
lvo_oURI = new URI(string(UriSchemeEnum:https),
'service.com').
lvo_Credentials = new Credentials('application',
'user',
'pwd').

lvo_AttRequest = RequestBuilder:POST(lvo_oURI, lvo_AttEntity, "multipart/mixed")
:UsingBasicAuthentication(lvo_Credentials)
:Request.
lvo_AttResponse = ResponseBuilder:Build():Response.

/* Execute the request */
lvo_HttpClient:Execute(lvo_AttRequest, lvo_AttResponse).

 

 

Thanks in advance for any feedback received!

Posted by xjg on 06-Nov-2017 09:00

Hi again Peter,

The input from os-dir was the issue. I've been able to fix it by defining a stream and use it to read the files contained in the specific directory!

Regards,

All Replies

Posted by Peter Judge on 03-Nov-2017 14:40

Which version?
 
 

Posted by xjg on 04-Nov-2017 07:00

Hello Peter,

I'm working with OpenEdge Release 11.6.1.

Regards,

Posted by xjg on 06-Nov-2017 05:41

Hello Peter,

I think I have spotted the issue, in order to find the attachment related my program is reading the directory:

input from os-dir(lvc_invAttchDir).

repeat:

import lvc_file.

run postAttachment // its code is shown in my first message of this thread

end.

input close.

 

If I directly call the postAttachment without looking for the file but directly assign the lvc_file value and I remove the input-from stuff it works fine... I'll keep digging in this direction.

 

Regards,

Posted by xjg on 06-Nov-2017 09:00

Hi again Peter,

The input from os-dir was the issue. I've been able to fix it by defining a stream and use it to read the files contained in the specific directory!

Regards,

This thread is closed