Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A lightweight SOAP client library for JavaScript
branch: titanium

This branch is 5 commits ahead, 1 commit behind kwhinnery:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
TitaniumDesktopExample/CurrencyConverter
TitaniumMobileExample/CurrencyConverter
LICENSE
README.md
suds.js

README.md

Suds: A JavaScript SOAP Client Library

XML is like violence - if it doesn't solve your problem, you're probably not using enough of it.

Suds is a lightweight SOAP client library for JavaScript. Suds has been tested on the following platforms:

  • Titanium Desktop (0.7.0)
  • Titanium Mobile (0.7.1)

For more information on creating native desktop and mobile apps with HTML, JavaScript, and CSS, check out the Appcelerator home page. Suds should also run in the web browser against SOAP web services, with the usual cross-domain restrictions. Suds has yet to be tested in the browser, however, so your mileage may vary. NOTE: While jQuery 1.3 is used in the example applications, Suds is not dependent upon it and can be used independently.

Usage

var suds = new SudsClient({ 
  endpoint: "http://webservice.webserviceshare.com/currencyconverter/rates.asmx",
  targetNamespace: "http://websevriceshare.com/" 
});

suds.invoke({
    soapAction : "GetSupportedCurrencies", 
    body : {
        param1 : "value1",
        param2 : "value2"
    },
    success :  function(xmlDoc) {
    //Parse XML response (SOAP Envelope)
    },
    error : function(){}
});

API

The following is the current API documentation for Suds, which consists of a constructor for the client and an invoke method on the client to call specific services on your endpoint. Impressive, no?

SudsClient(options)

Constructor for a Suds SOAP web service client.

  • options - A JavaScript object containing the following properties:
    • endpoint - the SOAP endpoint you will be using
    • targetNamespace - the namespace for your service data structures and prefix for SOAP actions - will be in your service WSDL
    • envelopeBegin (optional) - a string containing the XML preceding the contents of the SOAP request body
    • envelopeEnd (optional) - a string containing the XML following the contents of the SOAP request body
    • authorization (optional) - a string used to specify basic HTTP authorization in the request header
    • timeout (optional) - default : 5000 ms

sudsClient.invoke({soapAction : '', body : {}, success : function(xmlDoc){}, error : function(){}, header : '', RequestHeader : {} })

Invoke a SOAP action on the web service defined by this Suds instance.

  • soapAction - the web service method to invoke
  • body - can be one of:
    • An XML string containing the SOAP request body, constructed manually
    • A JavaScript object containing a hierarchical data structure which can be converted to XML
  • success - a callback function to process the request on success, with the following information
    • [this] - this inside your callback will refer to the XHR object used to make the SOAP web service call
    • xmlDoc - An XML Document Object containing the SOAP response
  • error - a callback function to process the request on error, with the following information
    • [this] - this inside your callback will refer to the XHR object used to make the SOAP web service call
  • header - additional information for soap header
  • RequestHeader - a Javascript object containing additional header for http request (eg : RequestHeader : { cookie : "foo" } )

Examples

Example applications using Suds for Titanium Mobile and Desktop are located in this project as well. Feel free to pull them down and import into Titanium Developer to see these projects in action. They should work out of the box using a publicly available SOAP web service.

Something went wrong with that request. Please try again.