Skip to main content
Participating Frequently
December 14, 2006
Question

Invoking web services from coldfusion page

  • December 14, 2006
  • 3 replies
  • 471 views
Hi there...

Could someone please help?
I am trying to invoke a webservice with .wdsl file which contains many methods. Does anybody know how to invoke this...This is my current code:

<cfinvoke
webservice = " http://localhost/callcredit.wsdl"
method1 ="Job5300"
method2="Job5301"
...
...
returnvariable="VarName"/>
<cfinvokeargument name="title" value="#form.title#"/>
<cfinvokeargument name= "forename" value="#form.forename#"/>
<cfinvokeargument name="surname" value="#form.surname#"/>
<cfinvokeargument name="DOB" value="#form.DOB#"/>
<cfinvokeargument name="buildingNumber" value="#form.buildingNumber#"/>
<cfinvokeargument name="postCode" value="#form.postCode#"/>


This is the error message I am getting at the moment:



[Web service operation "Job5300" with parameters {} could not be found]

Hoping this is understandable....could someone tell me what I am doing wrong...

Thanks

Critical
This topic has been closed for replies.

3 replies

Inspiring
December 18, 2006
Look to see if you have a <wsdl:types> or <types> element in the WSDL. that should be where it defines the type of parameters the different element types (i.e. nsp:webcr,nsp:apicr, etc) take. An easier way would be to load the webservice in Dreamweaver or .NET studio (if you have either of them), and it should give you a visual interface where you can take a look at the inputs for the webservice methods.
critical5Author
Participating Frequently
December 15, 2006
Thanks Insuractive,

As you can tell I am new to the whole idea of web services and coldfusion....anyway here goes...

I have the following code in my .wdsl code which I guess tells me what parameters and methods it is expecting from me
[<message name="SOAP_webcr">
<part name="io" element="nsp:webcr"/>
</message>
<message name="SOAP_apicr">
<part name="io" element="nsp:apicr"/>
</message>
<message name="SOAP_apipwc">
<part name="io" element="nsp:apipwc"/>
</message>
<message name="SOAP_apiucml">
<part name="io" element="nsp:apiucml"/>
</message>
<message name="header">
<part name="credentials" element="nsp:credentials"/>
<part name="action" element="nsp:action"/>
</message>
<portType name="soap_port">...] then methods

[<operation name="Job5300">
<input message="nsp:SOAP_webcr"/>
<output message="nsp:SOAP_webcr"/>
</operation>
<operation name="Job5301">
.................................]
My problem is: do i need just one parameter["io"] for all of my methods?.....how abt [<part name="credentials" element="nsp:credentials"/>
<part name="action" element="nsp:action"/>]............What are they??

Sorry if this sounds silly

Critical5
Inspiring
December 14, 2006
First off, all of your <cfinvokeargument> tags have to be nested within a <cfinvoke></cfinvoke> tag pair. It looks like you close the <cfinvoke> tag after you specify your return variable.

Secone, I think you may be restricted to calling only 1 method per <cfinvoke>. For example, you could use the following code to call your Job5300 method:

<cfinvoke
webservice = " http://localhost/callcredit.wsdl"
method="Job5300" returnvariable="VarName">

<cfinvokeargument name="foo" value="boo"/>
</cfinvoke>

and then another <cfinvoke> call for method Job5301.

If you want to avoid multiple <cfinvoke> calls, you could always create the webservice using CFOBJECT:

<cfobject webservice=" http://localhost/something.wsdl" name="objWS">
<cfset job5300result = objWS.job5300(var1, var2, etc)>
<cfset job5301result = objWS.job5301(var1, var2, etc)>
<cfset objWS = "">