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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

SOAP call getting failed

TanmeyTWX
17-Peridot

SOAP call getting failed

Hi,

I have created a service to invoke webservice and simply testing it to see results,if completed but getting HttpHostConnectException error.

as shown below:

Service :

2.PNG

Test Service:

1.PNG

Any comments on this??

8 REPLIES 8

Hi Tarun Nayyar

By looking at the error it seems that the url is not reachable. Could you please reconfirm if the url is accessible from the ThingWorx server or not?

Also, what are the errors in ThingWorx Application, Script, Communication logs

Thanks,

Ankit Gupta

Error in logs is same as in above Test Service window. And this URL is working fine if invoked by direct hit from TWX but not through TWX javascript

nkhose
12-Amethyst
(To:TanmeyTWX)

Hi Tarun ,

If that is the case with the same logs you counter , could you check what is result you are getting from postxml

Try result.toString() and see what response you get surely in the response there will be problem you have faced .

Also in the postxml you can pass username or pass if it is the authentication problem .

Also i cannot see the Namespace you have set in your code !

TanmeyTWX
17-Peridot
(To:nkhose)

sorry,I mis-interpreted the requirement.

I need to invoke a webservice url with single input and get the reposne in infotable.

What to do for that?

nkhose
12-Amethyst
(To:TanmeyTWX)

I'am assuming you have got the response , then it will be just the xml looping and bind the result to the infotable you created .

This will be on the fly result ... if the service ends too slow in getting result you can store the XML over the repository and then you can loop over

the repository XML for result in infotable

nkhose
12-Amethyst
(To:TanmeyTWX)

var searchParam = "";  // you can pass here input from mashup

var soapenv = new Namespace('http://schemas.xmlsoap.org/soap/envelope/');

    var asi = new Namespace('http://www.webservicex.net/');

    var content= <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:asi="http://www.webservicex.net/">

        <soapenv:Header/>

       <soapenv:Body>

  <GetGeoIP xmlns="http://www.webservicex.net/">

  <IPAddress>{searchParam }</IPAddress>

  </GetGeoIP>

  </soapenv:Body>

  </soapenv:Envelope>

                // SOAPEndpoint and SoapAction

    var headers = new Object();

    headers.SOAPAction = "http://www.webservicex.net/GetGeoIP";

    var params1 = {

        timeout : 60,

        headers : headers,

        ignoreSSLErrors : true,

        url : 'http://www.webservicex.com/geoipservice.asmx?WSDL',

        content : content

    };

    var soapEnv = new Namespace("SOAP-ENV","http://schemas.xmlsoap.org/soap/envelope/");

    var xmlResponse= Resources['ContentLoaderFunctions'].PostXML(params1);

  var params = {

    infoTableName : "InfoTable",

   dataShapeName : "testds"

  };

var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

var soapEnv = new Namespace("SOAP-ENV","http://schemas.xmlsoap.org/soap/envelope/");

    var rpc = new Namespace("http://www.webservicex.net/");

    var xmlRealm= xmlResponse.soapEnv::Body.rpc::GetGeoIPResponse;

    default xml namespace = "http://www.webservicex.net/";

  for each(var getInto in xmlRealm.GetGeoIPResult) {

            var newEntry = new Object();

            newEntry.CountryName = getInto.CountryName; // STRING

            newEntry.CountryCode=getInto.CountryCode;

            result.AddRow(newEntry);

    }

Let me know for any issues , bind the service after entering parameter from mashup on submit button or onchange of textbox

TanmeyTWX
17-Peridot
(To:nkhose)

It's still throwing error:

nkhose
12-Amethyst
(To:TanmeyTWX)

It's working fine at my end .. i ran at 5.4 as well as ThingWorx 6.5  for any glitch, what is your TW version , could please run the service and attach all logs here .

May be your TW server is not connecting to the specified Web-service Url or you are on proxy and trying to connect the Web-service Url .

Announcements


Top Tags