Article Preview
Buy Now
| PDF: |
Web Applications
Easy Web Services
Creating a Web API
Issue: 10.1 (November/December 2011)
Article Description: No description available.
Article Length (in bytes): 5,099
Starting Page Number: 81
RBD Number: 10012
Resource File(s):
10012.zip Updated: Tuesday, November 1, 2011 at 12:44 PM
Related Web Link(s):
http://en.wikipedia.org/wiki/Representational_state_transfer
http://www.twilio.com
Known Limitations: None
Excerpt of article text...
In issue 9.4, I commented that it would be really useful if Real Studio Web Edition could return simple data back to the client without embedding its JavaScript framework. It turns out this capability was added in Real Studio 2011 Release 2 with the App.HandleSpecialURL event.
App.SpecialHandleURL
This event allows your web application to handle specific URLs differently. These URL are ones that are within the path "/special". For example, when running locally, URLs that look like this would be handled by SpecialHandleURL:
http://127.0.0.1:8080/special/123
There is only a single parameter to this event: Request As WebRequest which will contain everything you need to process the request.
This event is incredibly useful because it essentially allows you to use Real Studio Web Edition to make web services.
Simple Web Service
We will create a simple web service that will add two numbers and return the result as XML.
First, create a web application project. In App.SpecialhandleURL add this code:
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|









