Make SOAP based Web service calls with Spry
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;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Call Webservice</title>
<script language="JavaScript" type="text/javascript" src="spry/includes/xpath.js"></script>
<script language="JavaScript" type="text/javascript" src="spry/includes/SpryData.js"></script>
</head>
<body>
<script>
var dsData = new Spry.Data.XMLDataSet("http://www.fekke.com/com/SpockWS.cfc", "/soapenv:Envelope/soapenv:Body/ns1:getQuoteResponse/getQuoteReturn", { method: "POST", postData: '<?xml version="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);
</script>
<div id="Specials_DIV" spry:region="dsData">
Episode: {episode} <br />
<em>{quote}</em><br />
Stardate: {stardate}
</div>
<input type="button" name="Do something" value="Get Quote" onclick="dsData.loadData();" />
</body>
</html>
The trick to getting this to work is setting the header attribute for the XMLDataSet method with a SOAPAction method.

I´m trying to get an XML with this line:
var dsTx = new Spry.Data.XMLDataSet("http://140.10.33.20:8080/struts-ajax/xml.do", "/transacciones/tx"
But I get tis error message:
Spry.Data.XMLDataSet.setDataFromDoc() failed to create dataSet ''for 'transacciones/tx' - http://172.16.48.121:8080/struts-ajax/xml.do
Thanks in advance, and sorry about my english!!!
I just tried to call that servlet, and nothing happened. You might want to try creating a static XML file first to be called from that server.
By the way, your English is fine. I grew up in the U.S., and I don't speak english good. . . well.
Thank you,
David Fekke.
You can pass the params in the XML that is being sent to the web service. You can see what the XML needs to look like by going to soapclient.com. The will need the WSDL file, but this site will show what the request and response should look like.
David
[url=http://www.sacekimmerkezi.org ]saç ekimi[/url]
[url=http://www.ankara-evnakliyat.org ]ankara nakliyat[/url]
[url=http://www.uluslararasi-nakliyat.org ]ankara nakliyat[/url]
[url=http://www.estetik-merkezleri.com ]estetik[/url]
[url=http://www.ankara-nakliyat.name.tr ]ankara nakliyat[/url]
[url=http://www.ankara-nakliyatcim.org ]ankara nakliyat[/url]
[url=http://www.ankara-nakliyeci.net ]ankara nakliyat[/url]
[url=http://www.estetik-merkezleri.com ]burun estetigi[/url]