[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: How to do UploadData using WebClient?

Status
Not open for further replies.
P

Peter Judge

Guest
That depends on what ipData is. The ABL HTTP client will convert many 'strongly typed objects' to an HTTP message (in bytes). The code below is an example of how you'd send a PATCH request using the ABL HTTP client. using OpenEdge.Net.HTTP.IHttpRequest. using OpenEdge.Net.HTTP.IHttpResponse. using OpenEdge.Net.HTTP.IHttpClient. using OpenEdge.Net.HTTP.ClientBuilder. using OpenEdge.Net.HTTP.RequestBuilder. using Progress.Json.ObjectModel.JsonObject. define variable req as IHttpRequest no-undo . define variable resp as IHttpResponse no-undo . define variable hc as IHttpClient no-undo . define variable jsonData as JsonObject no-undo . hc = ClientBuilder:Build():Client. req = RequestBuilder:patch(wc:BaseAddress + '/tasks' , ipdata, // this must be an OOABL object 'application/blah-blah' ) // content type of the data being sent : Request . resp = hc: Execute (req). if resp:StatusCode eq 200 then // do stuff with the response case resp:ContentType: when 'application/json' then assign jsonData = cast (resp:Entity, JsonObject). end case .

Continue reading...
 
Status
Not open for further replies.
Top