Web Service debug

Hi,
I’m trying to create a web service but cannot figure out how to debug it. I’m using HandleSpecialURL and I’m thinking maybe the Path is where I’m having a problem.

I’m a little confused regarding calling the web service. The web service is located: “http://mydomain.com/xo/api/Validate.cgi

The call I’m making is: RSocket.Send(“POST”, “http://mydomain.com/xo/Special/api/ValidateMembership.cgi”).
I started the app on the Web server and then realized I can’t see anything it does. As I understand it the handle special runs in a thread which means you can’t update UI elements.

So the first thing is I don’t know if the web services actually being hit by my iOS app and the second thing if it is how do I test the web service to see that it’s performing the way it’s expected to.

@Paul Lefebvre

I am building this based on your webinar, can you comment on this.

To test web services, use a tool such as Paw. Or the simple Resty app that I wrote about a while ago.

Not knowing how your app is implemented or deployed I can’t say much more. But like anything else, test the web service locally so you know it’s working before you deploy so you’ll then only have to test that your deployment was successful.

You might also want to take a look at the Eddie’s Electronics web service which we have running on Xojo Cloud. Information about that is here:

http://developer.xojo.com/eddies-electronics-web-service

This simple call displays results as JSON:
http://demos.xojo.com/EEWS/index.cgi/api/GetAllCustomers

Paul what confuses me is my web app is located: http://mydomain.com/xo/api/Validate.cgi

When I make the call I’m using: RSocket.Send(“POST”, “http://mydomain.com/xo/Special/api/ValidateMembership.cgi”)

This is my biggest question as I don’t think I’m calling it correctly. Does this make any sense?

Thanks

That does not look correct.

First you have both “Special” and “api” in the URL. Pick one.

Second, I think that should come after the app name. So I think you’d want something like this:

http://mydomain.com/xo/ValidateMembership.cgi/api/NameOfCall

Rather than creating your own implementation of this you might also want to check out Aloe Express.

Thanks I’ll try that. I actually named the directory the app is under “api”, oops!

Now I just need to get it to compile: https://forum.xojo.com/49151-help-ios-app-won-t-compile-to-run-in-debugger

Thanks Paul

@Paul Lefebvre

Still haven’t tried it as I still can’t compile.

You certainly don’t need a working iOS app to test a web service. As mentioned above there are plenty of other tools you can use to do that. It’s best when debugging to focus on one thing at a time, so maybe start by making sure your web service is deployed properly and working and then moving on to a simple iOS app that sends a request to the web app.

I know and I’ll try your app, but the compile issue has mover to the top of the list.

Thanks

@Paul Lefebvre

I downloaded Resty and the Eddies Web Service (EEWebService).

Here’s the url I used: http://127.0.0.1:8080/special/GetCustomer

In the Request Content I had: {“ID”: 10039}

I set Breakpoint in Web Serv HandleSpecialURL and the Webrequest.Entity is a blank string.

The http://127.0.0.1:8080/special/GetAllCustomers works as expected.

Note on my Web Service app I got the same thing, WebRequest.Entity = “”

From the RESTy blog post:

Doing that gives me the expected results.

@Paul Lefebvre

You nailed it! I can’t believe I wasted so much time.

Where were you 9 hours ago!

How do you know which to use.

Look at the docs for the API you are calling. In the case of the Eddie’s Electronics API, the doc page notes that you can call GetAllCustomers with GET or POST, but that GetCustomer must be called with POST.

[quote]GetAllCustomers
HTTP Method: GET or POST

GetCustomer
HTTP Method: POST[/quote]