I'm trying to learn web service using CFMX 6.1
This will be the first time I'm exposed to web service as far
as doing some coding with CF.
I found a good tutorial at:
http://www.adobe.com/devnet/coldfusion/articles/beginner_ws.html
I follow all the steps and it was successfull.
Then I'm trying to do the same thing but this time I'm
passing a query instead of a string and I got error (see below).
I've checked the web service I created by viewing the wsdl
file, it is functioning correctly (attached)
Here is the code:
simple_2.cfc:
<cfcomponent>
<cffunction name = "OurStocks" returnType = "query"
output = "no" access = "remote">
<cfquery name="qGetStock" datasource="Enroll">
select StockName, StockDimensions FROM Ref_PrintStock
</cfquery>
<cfreturn #qGetStock#>
</cffunction>
</cfcomponent>
Here is how I call the web service:
CallSimple_2.cfm:
<cfinvoke webservice="
http://localhost/test/Intro/simple_2.cfc?wsdl"
method="OurStocks"
returnvariable="returnedQuery"></cfinvoke>
<cfdump var="#returnedQuery#">
Here is the error I got:
Web service operation "OurStocks" with parameters {} could
not be found.
Here is my wsdl:
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="
http://Intro.test" xmlns:impl="
http://Intro.test" xmlns:intf="
http://Intro.test" xmlns:apachesoap="
http://xml.apache.org/xml-soap"
xmlns:wsdlsoap="
http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:tns1="
http://rpc.xml.coldfusion"
xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/"
xmlns="
http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <schema xmlns="
http://www.w3.org/2001/XMLSchema"
targetNamespace="
http://Intro.test">
<import namespace="
http://schemas.xmlsoap.org/soap/encoding/"
/>
- <complexType name="ArrayOf_xsd_string">
- <complexContent>
- <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]" />
</restriction>
</complexContent>
</complexType>
- <complexType name="ArrayOfArrayOf_xsd_anyType">
- <complexContent>
- <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:anyType[][]" />
</restriction>
</complexContent>
</complexType>
</schema>
- <schema xmlns="
http://www.w3.org/2001/XMLSchema"
targetNamespace="
http://rpc.xml.coldfusion">
<import namespace="
http://schemas.xmlsoap.org/soap/encoding/"
/>
- <complexType name="QueryBean">
- <sequence>
<element name="columnList" nillable="true"
type="impl:ArrayOf_xsd_string" />
<element name="data" nillable="true"
type="impl:ArrayOfArrayOf_xsd_anyType" />
</sequence>
</complexType>
- <complexType name="CFCInvocationException">
<sequence />
</complexType>
</schema>
</wsdl:types>
- <wsdl:message name="OurStocksResponse">
<wsdl:part name="OurStocksReturn" type="tns1:QueryBean"
/>
</wsdl:message>
<wsdl:message name="OurStocksRequest" />
- <wsdl:message name="CFCInvocationException">
<wsdl:part name="fault"
type="tns1:CFCInvocationException" />
</wsdl:message>
- <wsdl:portType name="Simple_2">
- <wsdl:operation name="OurStocks">
<wsdl:input name="OurStocksRequest"
message="impl:OurStocksRequest" />
<wsdl:output name="OurStocksResponse"
message="impl:OurStocksResponse" />
<wsdl:fault name="CFCInvocationException"
message="impl:CFCInvocationException" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="Simple_2.cfcSoapBinding"
type="impl:Simple_2">
<wsdlsoap:binding style="rpc" transport="
http://schemas.xmlsoap.org/soap/http"
/>
- <wsdl:operation name="OurStocks">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="OurStocksRequest">
<wsdlsoap:body use="encoded" encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
namespace="
http://Intro.test" />
</wsdl:input>
- <wsdl:output name="OurStocksResponse">
<wsdlsoap:body use="encoded" encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
namespace="
http://Intro.test" />
</wsdl:output>
- <wsdl:fault name="CFCInvocationException">
<wsdlsoap:fault use="encoded" encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
namespace="
http://Intro.test" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="Simple_2Service">
- <wsdl:port name="Simple_2.cfc"
binding="impl:Simple_2.cfcSoapBinding">
<wsdlsoap:address location="
http://localhost/test/Intro/Simple_2.cfc"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>