java.net.ConnectException: Connection refused when calling doHTTPRequest method

Hi Experts,

 

I’m calling an external azure api using script manager, here is my script below.

I get this error message(Error calling method: doHttpRequest  in class: com/hp/ov/sm/server/utility/HttpClient Exception (java.net.ConnectException: Connection refused: connect)) when trying to call the doHTTPRequest method.

I can send a POST and get results using POSTMAN using the same parameters.

Please assist.

// Use the following url value to produce an HTTP 400 error.

//var url = "">localhost:13080/IncidentManagement.wsdl";

 

// Use the following url value to produce valid WSDL.

var url = "https://xxxx.logic.azure.com:443/workflows/xxx/triggers/manual/paths/invoke?api-version=2016-06-01&sp=/triggers/manual/run&sv=1.0&sig=xxxsPcrtw";

 

var h = new Header( "Accept-Encoding", "gzip,deflate" );

var hd = new Header();

hd.name = "Content-Type";

hd.value = "application/json";

var authHeader          = new Header();

authHeader.name         = "No auth";

authHeader.value        = null;    

     

var headers = new Array();

headers.push( h );

headers.push( hd );

headers.push(authHeader);

 

var WSDLrequest;

var reply;

var respHeaders = new Object();

var msg = system.library.JSON.json();

 

msg = {

        "Title": "This is a title 2",

        "Call Reference": "SD123457",

        "Business Process": "Not sure what goes here",

        "Explanation": "Because I want it"

};

 

 

try

      {

 

       WSDLrequest = doHTTPRequest( "POST", url, headers, msg, 10, 10, null, respHeaders );

       print( "The response headers of the doHTTPRequest is:" );

       for( var name in respHeaders )

      {

          print( name "=" respHeaders[name] );

      }

        print( "The result of the doHTTPRequest is \n" WSDLrequest );

        reply = writeFile( "C:\\IncidentManagement.wsdl", "text", WSDLrequest );

      }

catch ( e )

      {

       print( "WSDL request failed with exception \n" e );

      }

 

Thanks

Sivu

  • copy of the log file:

     

    32596( 19484) 11/06/2017 14:28:29 JRTE E Error in doHttpRequest()
    java.net.ConnectException: Connection refused: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1283)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1258)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
    at com.hp.ov.sm.server.utility.HttpClient.doHttpRequest(HttpClient.java:173)
    at com.hp.ov.sm.server.utility.HttpClient.doHttpRequest(HttpClient.java:93)
    at com.hp.ov.sm.server.utility.TopazThread.handleRequest(Native Method)
    at com.hp.ov.sm.server.utility.TopazThread.processRequest(TopazThread.java:413)
    at com.hp.ov.sm.server.utility.TopazThread.process(TopazThread.java:339)
    at com.hp.ov.sm.server.utility.TopazThread.run(TopazThread.java:354)
    32596( 19484) 11/06/2017 14:28:29 RTE E Error calling method: doHttpRequest in class: com/hp/ov/sm/server/utility/HttpClient Exception (java.net.ConnectException: Connection refused: connect)

     

    Thanks again guys