Skip to main content
1-Visitor
April 25, 2018
Question

Error while consuming web-service: Connection refuse: connect

  • April 25, 2018
  • 4 replies
  • 2991 views

Hello,

While consuming web service which returns XML, I am getting below error:connection refuse.PNG

Application log:

[context: com.thingworx.webservices.context.HttpExecutionContext@4d1285e][message: Execution error in service script [test2] :: Connect to www.holidaywebservice.com:80 [www.holidaywebservice.com/50.62.169.119] failed: Connection refused: connect]

 

Service Code:

var params1 = {
proxyScheme: undefined /* STRING */,
headers: undefined /* JSON */,
ignoreSSLErrors: undefined /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
withCookies: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: "http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx/GetCountriesAvailable?CountryCode=Canada" /* STRING */,
timeout: undefined /* NUMBER */,
proxyPort: undefined /* INTEGER */,
password: undefined /* STRING */,
domain: undefined /* STRING */,
username: undefined /* STRING */
};
// result: XML
var resultXML = Resources["ContentLoaderFunctions"].GetXML(params1);
var params2 = {
infoTableName : "InfoTable",
dataShapeName : "SOAP_DataShape"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(StringDataShape)
var result1 = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params2);
for each (var tag in resultXML.*::HolidayCode) {
var newRow = new Object();
newRow.HolidayCode = tag.*::Code;
newRow.Description=tag.*::Description;
result1.AddRow(newRow);
}
result=result1;

 

I am using TWX 8.2.1, any suggestion?

Thanks!

4 replies

22-Sapphire I
April 25, 2018

It says Connection refused, did you try this with something like Postman and did it work with Postman?

Connection Refused probably means you aren't calling the right end point or it doesn't like where the call is coming from.

1-Visitor
November 23, 2018

Its working with postman and soap UI. But in thingworx whatever url I give it says refuced to connect except localhost.

Do we have node js plugin for thingworx.

1-Visitor
November 23, 2018

I've tested on my side and it works, I think that you have a problem with your server which isn't allowing outgoing communications (maybe you ha firewall rule or alike)