I've install the IP*Works Trial components to use the JSON component to request RESTful services.
I've managed to get this code working using standard HttpWebRequest but now with the IP*Works components I am getting an error that I cannot fathom.
IDE: Xamarin
Project: iOS Mobile iPhone/iPad app
Language: C#
Error is: Connection attempt failed (AddressFamilyNotSupported).
My code is:
public string getCSRFToken()
{
string csrfToken = "";
Json ipwRest = new Json ();
ipwRest.ContentType = "application/json";
try{
ipwRest.Post(@"http://localhost:9007/quote-and-buy-performance/api/user/token.json");
csrfToken = ipwRest.TransferredData;
Console.Out.WriteLine ("getCSRFToken->Response: " + csrfToken.ToString());
}catch(IPWorksJsonException jsonerror){
Console.Out.WriteLine (jsonerror.Message);
}
return csrfToken;
}
What else I have tried:
- Change from localhost to 127.0.0.1 - For this I get a 302 and the URL then also does not return any JSON in POSTMAN client.
- Changed between GET and POST methods
- Removed .json extension on url
- Changed to REST object instead of Json i.e. Rest ipwRest = new Rest ();
- IP*Works documentation of errors suggests this is a TCP/IP error but no further information.