Problems with HTTP Request working with an outbound operation EnsLib.REST.Operation
Trying to get an outbound operation working using the EnsLib.REST.Operation class but having problems
from the Operation
{
Parameter ADAPTER = "EnsLib.HTTP.OutboundAdapter";
Property Adapter As EnsLib.HTTP.OutboundAdapter;
Parameter INVOCATION = "Queue";
Method ProcessTaskEX(pRequest As Ens.Request, Output pResponse As Ens.Response As %Status
{
// Get URL
Set tURL=..Adapter.URL
// Execute the call
Set tSC=..Adapter.PostURL(tURL,.tHttpResponse)
//Return the response
If $$$ISERR(tSC)&&$IsObject(tHttpResponse)&&$IsObject(tHttpResponse.Data)&&tHttpResponse.Data.Size
{
Set tSC=$$$ERROR($$$EnsErrGeneral,$$$StatusDisplayString(tSC)_":"_tHttpResponse.Data.Read())
}
Quit:$$$ISERR(tSC)
I have the following settings in Operation
HTTP Server : jsonplaceholder.typicode.com
HTTP Port : 443
URL : /Posts/URL
everything else is default.
Trying to get to https://jsonplaceholder.typicode.com/posts/42
From a browser this requestworks fine and returns ( you can test this in your own broswer)
{ "userId": 5, "id": 42, "title": "commodi ullam sint et excepturi error explicabo praesentium voluptas", "body": "odio fugit voluptatum ducimus earum autem est incidunt voluptatem\nodit reiciendis aliquam sunt sequi nulla dolorem\nnon facere repellendus voluptates quia\nratione harum vitae ut" }
But from Ensemble I get a problem.
Output from Foreground trace is as follows
10:42:23.411:Ens.Job: ConfigItem 'FSE Outbound' (LPCH.FSE.DictionaryItems.All.Operation) started in job 8152
10:42:38.560:...ems.All.Operation: ERROR <Ens>ErrGeneral: ERROR <Ens>ErrHTTPStatus: Received non-OK status 400 from remote HTTP server: 'HTTP/1.1 400 Bad Request':<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>cloudflare</center>
</body></html>
Any pointers on what I am doing wrong please - or some example code on how to do this?
Thanks
A