Appcelerator Blog

The Leading Resource for All Things Mobile

Arrow SOAP Connector Demo

31 Flares 31 Flares ×

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 app 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 APIs that mobile devices prefer.

This blog post is a short demonstration of the Arrow SOAP Connector.

For this demo, we will use the CDYNE SOAP Weather Service. The WSDL for this service can be found here.

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 to build mobile-optimized API’s.

First, create new Arrow project:

appc new

Install the SOAP connector:

appc install connector/appc.labs.soap

Add the 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 following 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:

Summary

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 by automatically creating all your APIs for you. Give it a spin for yourself!

31 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 31 Email -- 31 Flares ×

Sign up for updates!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
31 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 31 Email -- 31 Flares ×