cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Error while consuming web-service: Connection refuse: connect

jakhtar-2
2-Explorer

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 4
PaiChung
22-Sapphire I
(To:jakhtar-2)

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.

PratikJain
6-Contributor
(To:PaiChung)

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.

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)

mgoel
17-Peridot
(To:CarlesColl)

@jakhtar-2

 

Hope you are doing good. Could you please confirm if the issue has been resolved.

 

If yes, please mark the answer as accept as solution for the future reference. Thank you in advance.

Regards-Mohit Goel

Announcements


Top Tags