0

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.
Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
John Cogan
  • 1,034
  • 4
  • 16
  • 39
  • You are trying to connect to a service running on the device? – Jason Jul 17 '15 at 14:39
  • No, its a remote web service, in this case its running on localhost but I get the same result if I try connect to our remote test server also. – John Cogan Jul 20 '15 at 10:43

0 Answers0