Whatever message this page gives is out now! Go check it out!
Method | CFML operator | Description |
CFScript | () | Consumes a web service from within a CFScript block. |
CFML tag | Consumes a web service from within a block of CFML code. | |
CFML tag | Consumes a web service from within a block of CFML code. |
<part name="zipcode" type="xsd:string"/> </message> <message name="getTempResponse"> <part name="return" type="xsd:float"/> </message> <portType name="TemperaturePortType"> <operation name="getTemp"> <input message="tns:getTempRequest"/> <output message="tns:getTempResponse"/> </operation> </portType> |
<part name="zipcode" type="xsd:string"/> </message> <message name="getTempResponse"> <part name="return" type="xsd:float"/> </message> <portType name="TemperaturePortType"> <operation name="getTemp"> <input message="tns:getTempRequest"/> <output message="tns:getTempResponse"/> </operation> </portType> |
webservice="http://www.xmethods.net/sd/2001/TemperatureService.wsdl" method="getTemp" returnvariable="aTemp"> <cfinvokeargument name="zipcode" value="55987"/> </cfinvoke> <cfoutput>The temperature at ZIP code 55987 is #aTemp#</cfoutput> |
stArgs = structNew(); stArgs.zipcode = "55987"; </cfscript> <cfinvoke webservice="http://www.xmethods.net/sd/2001/TemperatureService.wsdl" method="getTemp" argumentcollection="#stArgs#" returnvariable="aTemp"> <cfoutput>The temperature at ZIP code 55987 is #aTemp#</cfoutput> |
webServiceName.operationName(inputVal1, inputVal2, ... ); |
resultVar = webServiceName.operationName(inputVal1, inputVal2, ... ); |
writeoutput(webServiceName.operationName(inputVal1, inputVal2, ...) ); |
ws = CreateObject("webservice", "http://www.xmethods.net/sd/2001/TemperatureService.wsdl"); xlatstring = ws.getTemp("55987"); writeoutput(xlatstring); </cfscript> |
ws = CreateObject("webservice", "http://www.xmethods.net/sd/2001/TemperatureService.wsdl"); xlatstring = ws.getTemp(zipcode = "55987"); writeoutput("The temperature at 55987 is " & xlatstring); </cfscript> |
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getTemp"> <soap:operation soapAction=""/> <input> <soap:body use="encoded" namespace="urn:xmethods-Temperature" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body use="encoded" namespace="urn:xmethods-Temperature" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> |
Place your application code here ... <cfcatch type="application"> <!--- Add exception processing code here ... ---> </cfcatch> ... <cfcatch type="Any"> <!--- Add exception processing code appropriate for all other exceptions here ... ---> </cfcatch> </cftry> |
<cfscript> ws=createobject("webservice", "URLtoWSDL") ws.modifyString("S"); </cfscript> <cfoutput>#S#</cfoutput> |
ws = CreateObject("webservice", "http://www.xmethods.net/sd/2001/TemperatureService.wsdl"); xlatstring = ws.getTemp("55987"); writeoutput(xlatstring); </cfscript> |
ws = CreateObject("webservice", "wsTemp"); xlatstring = ws.getTemp("55987"); writeoutput("wsTemp: " & xlatstring); </cfscript> |
<part name="zipcode" type="xsd:string"/> </message> <message name="getTempResponse"> <part name="return" type="xsd:float"/> </message> |
ColdFusion data type | WSDL data type |
numeric | SOAP-ENC:double |
Boolean | SOAP-ENC:boolean |
string | SOAP-ENC:string |
array | SOAP-ENC:Array |
binary | xsd:base64Binary |
numeric | xsd:float |
string | xsd:enumeration |
date | xsd:dateTime |
void (operation returns nothing) | |
struct | complex type |
query | tns1:QueryBean (Returned by CFCs) |
<cffunction name='echoQuery' returnType='query' access='remote'> <cfargument name='input' type='query'> <cfreturn #arguments.input#> </cffunction> </cfcomponent> |
<wsdl:part name="echoQueryReturn" type="tns1:QueryBean"/> </wsdl:message> <wsdl:message name="echoQueryRequest"> <wsdl:part name="input" type="tns1:QueryBean"/> </wsdl:message> |
<title>Passing queries to web services</title> </head> <body> <cfquery name="GetEmployees" datasource="cfdocexamples"> SELECT FirstName, LastName, Salary FROM Employee </cfquery> <cfinvoke webservice = "http://localhost/echotypes.cfc?wsdl" method = "echoQuery" input="#GetEmployees#" returnVariable = "returnedQuery"> <cfoutput> Is returned result a query? #isQuery(returnedQuery)# <br><br> </cfoutput> <cfoutput query="returnedQuery"> #FirstName#, #LastName#, #Salary#<br> </cfoutput> </body> |