Skip to main content
Known Participant
March 12, 2008
Question

help for Web service please.

  • March 12, 2008
  • 2 replies
  • 575 views
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>












This topic has been closed for replies.

2 replies

Inspiring
March 13, 2008
Hi,

It might be due to the stub files created by CF... Try refreshing your Webservice entry in the CFIDE/Administrator panel, It will work fine.
aleckenAuthor
Known Participant
March 13, 2008
Oh Thank you!!!!
Do you mind briefly explain why refreshing the web sevice through administrator works?
Do I have to do this everytime I created a web service or once is enough? can it be done through code?
Inspiring
March 12, 2008
My guess is that you didn't define a directory on your admin page where web services reside. The key word is guess.