If you can stick with simple data types, using a RESTful approach is the easiest. Although simple data types may not be possible for all all web calls.
However, we may not need to decide. If using the C# (.NET) programming language, it automatically provides support for both. Look at my example below.
Webservice Call
Code:[WebMethod(Description = "Returns search results for custom searches")] public SearchLocations[] Search(double longitude, double latitude, string searchtext) { GoogleConnector myConnect = new GoogleConnector(); GPSLocation myGPS = new GPSLocation(longitude, latitude); return myConnect.Search(searchtext, myGPS); }
Soap Call
RESTful CallCode:POST /DrivnOnline.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://nextabyte.com/webservices/Search" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Search xmlns="http://nextabyte.com/webservices"> <longitude>double</longitude> <latitude>double</latitude> <searchtext>string</searchtext> </Search> </soap:Body> </soap:Envelope>
Code:POST /DrivnOnline.asmx/Search HTTP/1.1 Host: localhost Content-Type: application/x-www-form-urlencoded Content-Length: length www.somewebsite.com/servicename/Search?longitude=string&latitude=string&searchtext=string
While RESTful is the easiest to do for simple functions with basic datatypes.... NOT ALL FUNCTIONS will allow for simple datatypes. For client-webservice calls, I think the best way to go is full SOAP compatibility. While harder to use, it offers so much more functionality.
However, for web front-ends, RESTful is a must as using SOAP is much more complex using PHP and HTML. For calls made by web calls, REST should be used if possible.



LinkBack URL
About LinkBacks

Reply With Quote


Bookmarks