Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

help for Web service please.

Community Beginner ,
Mar 12, 2008 Mar 12, 2008
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>












TOPICS
Getting started
466
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 12, 2008 Mar 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 13, 2008 Mar 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 13, 2008 Mar 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 13, 2008 Mar 13, 2008
alecken wrote:
> Oh Thank you!!!!
> Do you mind briefly explain why refreshing the web service through administrator works?


CF caches the 'signature' of a web service. The signature of a web
service is the URI, the names and return types of the methods and the
parameter names and types. When one changes any of these elements, one
needs to refresh the cache. That is the purpose of that control in the
administrator. There are other ways to do this as well, if one does not
have access to the administrator.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 13, 2008 Mar 13, 2008
Do you mind refer me to article/tag on how can I learn "the other way" to prevent CF caches?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 13, 2008 Mar 13, 2008
alecken wrote:
> Do you mind refer me to article/tag on how can I learn "the other way" to prevent CF caches?


Well you can't prevent it. Caching is desired and designed behavior.
But IIRC there is a programmatic way to refresh the cache if one does
not have access to the administrator. Read up the CF documentation on
web services. If you don't have these documents the Internet does.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 13, 2008 Mar 13, 2008
LATEST
Hi,

In addition to Ian's comments, if you want to refresh your webservice entry programatically, you can do this by utilising the "ServiceFactory" class. A great tutorial on this is avaiable at,

http://www.bpurcell.org/blog/index.cfm?mode=entry&ENTRY=965&REFERRER=year2003stats

HTH
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources