X
xjg
Guest
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 file being posted and later to post the file (if any). 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. Another remarkable point is that the code works fine if I directly call it from the Openedge Procedure Editor. However, my program is supposed to work as a post-processor so I've faced this error once I've set the complete flow and my program is being called by the process instead of directly by me. 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
ut(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
OST(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!
Continue reading...
Continue reading...