Question
· Sep 3, 2018

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

Class LPCH.FSE.DictionaryItems.All.Operation Extends EnsLib.REST.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

Discussion (3)0
Log in or sign up to continue

If your Operation config. is exactly as described above then I think that's your problem - the settings to get back specifically that one document should (I think) be:

HTTP Server : jsonplaceholder.typicode.com

HTTP Port : 443

URL : /posts/42

(Assuming you've got a SSL config. set up in the Operation btw, because that URL is https).

If that doesn't work let me know and I'll try knocking up my own code to do it.

Ok - good news/bad news sort of thing.

I can get you a bit further - I tried a quick test locally and it looks like you do need an SSL config. but in my instance there's some issue with negotiating the SSL connection that's causing it to fail.

Anyway - SSL configuration - from the homepage of your Management Portal go to System Administration -> Security -> SSL/TLS Configurations and click on "Create New Configuration". Give it the Configuration Name "typicode" and Save it.

Back in your Ensemble production select your Business Operation and in the configuration look for the "Connection Settings" section - there should be a dropdown for "SSL Configuration" and if everything's worked above then "typicode" should be a selectable value. Select that and Apply the config. and then try again.

If you get "ERROR #6085: Unable to write to socket with SSL/TLS configuration 'typicode', error reported 'SSL/TLS error in SSL_connect(), SSL_ERROR_SSL: protocol error, error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'" then you're at the same point as me.