REST call via mid server debugging

erikbos
Giga Contributor

Hi,

I am trying to setup a REST call to retrieve data from an internal application via the midserver. I have defined the webserver via the UI and use JS to make the call and use the predefined webservice. In the WS definition for the GET method I have set the mid server to use.

At the moment I am just interested in making the call itself and do not care yet about parsing the json response yet: I am trying it with a few lines of code to log whether the call itself was successful or not.

var r = new sn_ws.RESTMessageV2('Device42', 'get');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.log(httpStatus);

The code executes but hangs and I need to terminate it.

In the ECC queue I see an entry for every attempt I have done so far so I think the API call request gets queued for the mid server. An ECC queue entry contains the following XML as content:

<?xml version="1.0" encoding="UTF-8"?>

<parameters>

  <parameter name="message_headers" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;fields/&gt;"/>

  <parameter name="message_parameters" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;fields/&gt;"/>

  <parameter name="source" value="X"/>

  <parameter name="name" value="get"/>

  <parameter name="rest_user" value="............."/>

  <parameter name="rest_password" value="enc:...................."/>

</parameters>

On the mid server in the logs I do not see anything related to REST messages, this API end point, etc: like it did not receive this ecc queue entry at all. (I have set 'debug.logging' to true).  


Doing the API call by hand using curl on the mid server works fine so connectivity from the mid server to the internal application is ok.

Any idea how I debug this any further?