Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

webservices testing using REST API

Hi below is the snippet from sahi pro 5.x
var $request = new RESTRequest();
$request.setURL("http://www.webservicex.net/geoipservice.asmx/GetGeoIP";);
$request.addToQueryString("IPAddress", "72.14.228.129");
var $response = $request.submit("get");
var $responseBody = $response.getBodyAsString();

// The response is in the form of an xml, so we will parse the xml.
// Alternatively, this can be JSON in which case, we would need to eval the JSON to get the output object attributes.
$data = $responseBody.replace(/<\?xml[^>]*\?>/, "").replace(/(\r\n|\n|\r)/gm,"");
default xml namespace = "http://www.webservicex.net/";
var $x = new XML($data);
var $CountryCode= $x..CountryCode[0].toString();
_alert($CountryCode);

i assume this would work in sahi 7.5 ?
i see that while invoking the webservices we need to pass the IP address 72.14.228.129 ? is that the server IP where the webservices is running
Thx
K.Thulsi

Comments

Sign In or Register to comment.