jsonsocketsvariableswebxojo

How can I load JSON from the Web with XOJO?


I'm new to XOJO and I'm making a Web App to list the time entries of my co-workers.

The Code looks like this:

Dim Socket as new HTTPSocket
Dim d As New Dictionary
Dim result As String

Socket.SetRequestContent("","application/json; charset=utf-8")
result = Socket.get("http://teamwork.companyname.com/time/total.json?userId=111111", 30) 
result = DefineEncoding(result, Encodings.UTF8)

OutputArea3.Text = result

When I replace the URL with www.example.com, it works and the content can be loaded. I also tried it with various URL's for different JSON's from the Web, but it didn't work too.

What should I use, so that JSON's can be loaded?

Many Thanks for your advice


Solution

  • I solved it by myself. I made a Subclass of HTTPSocket called CustomHTTPSocket and implemented the AuthenticationRequired Event with my login:

    name="username"
    password="password"
    return true
    

    Now it works :)