By David Fekke
January 17th, 2011
I decided to try to use Spry to make a SOAP based web service call using a ColdFusion CFC for the web service.
Spry 1.1 allows developers to make GET and POST method calls for DataSets. Here is an example I wrote that calls one of my quote web services;
var dsData = new Spry.Data.XMLDataSet("http://www.fekke.com/com/SpockWS.cfc", "/soapenv:Envelope/soapenv:Body/ns1:getQuoteResponse/getQuoteReturn", { method: "POST", postData: '"1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://com" xmlns:intf="http://com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://rpc.xml.coldfusion" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >SOAP-ENV:Body<mns:getQuote xmlns:mns="http://com" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></mns:getQuote></SOAP-ENV:Body></SOAP-ENV:Envelope>', headers: { "Content-Type": "text/xml; charset=utf-8", "SOAPAction": "http://localhost:8300/com/SpockWS/getQuote" } , useCache: false });
dsData.startLoadInterval(10000);
<div id="Specials_DIV" spry:region="dsData">
Episode: {episode}
{quote}
Stardate: {stardate}
<input type="button" name="Do something" value="Get Quote" onclick="dsData.loadData();" />