CF Web Servies help needed - newbie

CF Web Servies help needed - newbie

Post by jl » Wed, 15 Feb 2006 23:06:30



Hello,
I am having trouble with getting a CF web service to work. I have a
.cfc file named
WSTry.cfc. I am using the <cfinvoke> tag to consume the web service.

<cfinvoke
  webservice="someURL/WSTry.cfc?wsdl"
  method="getMessage"
  returnvariable="aString">
    <cfinvokeargument name="aname" value="Joe"/>
        <!---<cfinvokeargument name="theArray" value="tarray"/> --->
</cfinvoke>

When I change the argument name in both the cfinvoke and the .cfc file
to "name" it works fine, however when I use "aname" for the argument
name I get the following error

Web service parameter name "name" could not be found in the provided
parameters {aname}.
The error occurred in someURL\WSTry.cfm: line 32
30 :   method="getMessage"
31 :   returnvariable="aString">
32 :     <cfinvokeargument name="aname" value="Joe"/>
33 :    <!---<cfinvokeargument name="theArray" value="tarray"/> --->
34 : </cfinvoke>

If I hit the .cfc page directly from the browser it returns the SOAP
XML just fine. That listing is at the end. If anyone has any
suggestions I would greatly appreciate it. Thanks in advance.
Joe

WSTry.cfc
<cfcomponent displayname="Pass a message back to calling program">
  <cffunction name="getMessage" access="remote" returntype="string"
output="no">
      <cfargument name="aname" type="string">
      <cfreturn "Hello " & arguments.name &"! " & "I've been invoked as
a web service.">
  </cffunction>
</cfcomponent>

WSTry.cfc?wsdl
  <?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://cfc.virtualauthor"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://cfc.virtualauthor"
xmlns:intf="http://cfc.virtualauthor"
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">
- <!-- WSDL created by Macromedia ColdFusion MX version 7,0,1,116466
  -->
- <wsdl:types>
- <schema targetNamespace="http://rpc.xml.coldfusion"
xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="CFCInvocationException">
  <sequence />
  </complexType>
  </schema>
  </wsdl:types>
- <wsdl:message name="getMessageResponse">
  <wsdl:part name="getMessageReturn" type="soapenc:string" />
  </wsdl:message>
- <wsdl:message name="CFCInvocationException">
  <wsdl:part name="fault" type="tns1:CFCInvocationException" />
  </wsdl:message>
- <wsdl:message name="getMessageRequest">
  <wsdl:part name="aname" type="soapenc:string" />
  </wsdl:message>
- <wsdl:portType name="WSTry">
- <wsdl:operation name="getMessage" parameterOrder="aname">
  <wsdl:input message="impl:getMessageRequest" name="getMessageRequest"
/>
  <wsdl:output message="impl:getMessageResponse"
name="getMessageResponse" />
  <wsdl:fault message="impl:CFCInvocationException"
name="CFCInvocationException" />
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="WSTry" type="impl:WSTry">
  <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getMessage">
  <wsdlsoap:operation soapAction="" />
- <wsdl:input name="getMessageRequest">
  <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cfc.virtualauthor" use="encoded" />
  </wsdl:input>
- <wsdl:output name="getMessageResponse">
  <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cfc.virtualauthor" use="encoded" />
  </wsdl:output>
- <wsdl:fault name="CFCInvocationException">
  <wsdlsoap:fault
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
name="CFCInvocationException" namespace="http://cfc.virtualauthor"
use="encoded" />
  </wsdl:fault>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="Pass a message back to calling program">
- <wsdl:port binding="impl:WSTry" name="WSTry.cfc">
  <wsdlsoap:address
location="http://67.59.137.2/virtualauthor/cfc/WSTry.cfc" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>