SOAP (Simple Object Access Protocol) is a messaging protocol that allows programs that run on disparate operating systems to communicate using Hypertext Transfer Protocol (HTTP) and its Extensible Markup Language (XML). Even though REST web services are growing in popularity, if you are building a mobile application that connects to Enterprise Data sources most likely that data is exposed as a SOAP web service. Arrow's SOAP connector makes it very easy to expose SOAP services as mobile optimized REST API's that mobile devices prefer.
This blog post is a short demonstration of the Arrow SOAP Connector. You can find information about the connector at software.appcelerator.com.
For this demo, we will use the CDYNE SOAP Weather Service. The WSDL for this service can be found here:
http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl
One operation exposed by the service is GetCityWeatherByZIP which takes a zipcode as a parameter and returns the current weather. Try it out here
Let's use the Arrow SOAP Connector and build mobile optimized API's.
Create new Arrow project
appc new
Install the SOAP connector
appc install connector/appc.labs.soap
Add WSDL URL above to the SOAP config file in the soapWSDL property and set modelAutogen to true to automatically generate the API's as follows:
module.exports = {
connectors: {
'appc.labs.soap': {
soapWSDL: 'http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl',
generateModelsFromSchema: true,
modelAutogen: true,
handleResponse: function (result, next) {
if (result.Success === false) {
next(result.ResponseText);
}
else {
next(null, result);
}
}
}
}
};
Run the Arrow project
appc run
Test the Arrow API's in the Arrow admin console by entering the followinf URL in your browser:
http://127.0.0.1:8080/arrow/index.html
Select the API Docs tab, click on the appc.labs.soap/Global API and scroll down to the GET /api/appc.labs.soap/global/GetCityWeatherByZIP API and enter a zip code to check the weather as follows
In this example, we saw how easy it is to use the Arrow SOAP Connector. All you need is your SOAP WSDL and the connector does the rest and automatically creates all your APIs for your.