Skip to main content
1-Visitor
Apr 25, 2018 5:55 AM UTC
Question

Error while consuming web-service: Connection refuse: connect

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
Apr 25, 2018 9:10 PM UTC

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.

Translate
1-Visitor
Nov 23, 2018 10:50 AM UTC

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.

Translate
1-Visitor
Nov 23, 2018 12:41 PM UTC

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)

Translate