Hi Allistar, and thanks for your response.
In an attempt to get this working, I found a free REST based WS to consume.
It is: "http://services.groupkt.com/country/get/iso2code/IN"
and when entered in the browser, shows the following (for code IN, being India):
{
"RestResponse" : {
"messages" : [ "Country found matching code [IN]." ],
"result" : {
"name" : "India",
"alpha2_code" : "IN",
"alpha3_code" : "IND"
}
}
}
So I am trying to use the example that you got working to consume this WS using the JadeHTTPConnection class.
I note the getHttpPageBinary method (I'm in Jade 7.1.05) has an additional parameter to the example, that you have noted, and suspect to be the pServer parameter.
I tried the following, but get no runtime error and status is 0 and result is null. Get same result with null for the last 2 parameters as well.
I suspect there is something pretty obvious that I have missed, or not setup.
From your experience, you might notice the mistake easily ?
My amended code, using the changed endpoint, and GET rather than post, and additional parameter does
vars
connection: JadeHTTPConnection;
data, result: String;
status: Integer;
begin
create connection transient;
data := '{"someInput":"someValue"}';
//result := connection.getHttpPageBinary("POST", "https://domain/endpoint/blah.json", data, "application/x-www-form-urlencoded").ansiToString();
result := connection.getHttpPageBinary("GET", null, "http://services.groupkt.com/country/get/iso2code/IN", data, "application/x-www-form-urlencoded").ansiToString();
status := connection.queryStatusCode();
if (status <> 200) then
write "Status="& status.String & " ::Result= "& result;
//handleRequestError(connection, status, result);
endif;
write "Result=" & result;
epilog
delete connection;
end;
Any comment, or you able to paste into jadeScript and try it and let me know where I'm going wrong.
If you can't point me in the right direction I'll talk to the Jade plant.
cheers
Mike