cfinvoke

Does either of the following:

* Invokes a component method from within a CFML page or
component.
* Invokes a web service.
Different attribute combonations make some attributes required
at sometimes and not at others.

 <cfinvoke method="">

 cfinvoke(method="");

Attribute Reference for the cfinvoke tag

component

Required: No
String or component object; a reference to a component, or
component to instantiate.

method

Required: Yes
Name of a method. For a web service, the name of an
operation.

returnvariable

Required: No
Name of a variable for the invocation result.

argumentcollection

Required: No
Name of a structure; associative array of arguments to pass
to the method.

username

Required: No
Overrides username specified in Administrator > Web Services

password

Required: No
Overrides passowrd specified in Administrator > Web Services

webservice

Required: No
The URL of the WSDL file for the web service.

timeout

Required: No
The timeout for the web service request, in seconds

proxyserver

Required: No
The proxy server required to access the webservice URL.

proxyport

Required: No
The port to use on The proxy server.

proxyuser

Required: No
The user ID to send to the proxy server.

proxypassword

Required: No
The user's password on the proxy server.

serviceport

Required: No
CF 7+ The port name for the web service. This value is
case-sensitive and corresponds to the port element's
name attribute under the service element. Specify this
attribute if the web service contains multiple ports.
Default: first port found in the WSDL.

refreshwsdl

Required: No
Default: NO
CF 8+ * yes: reload the WSDL file and regenerate the artifacts used to consume the web service
* no

wsdl2javaargs

Required: No
CF 8+ A string that contains a space-delimited list of arguments to pass to the WSDL2Java tool that generates Java stubs for the web services.

wsVersion

Required: No
CF 10+ Used to specify the version of Apache Axis (web service engine used by CF) to use. Specify 1 for Axis Version 1 or 2 for Axis 2. Values:
  • 1
  • 2

Examples sample code using the cfinvoke tag


Invoke a SOAP webservice using cfinvoke

Calls a remote web service to perform an addition, uses cfinvokeargument to pass the arguments to the method.

<cfinvoke webservice="http://soaptest.parasoft.com/calculator.wsdl" method="add" returnvariable="answer">
    <cfinvokeargument name="x" value="2">
    <cfinvokeargument name="y" value="3">
</cfinvoke>
<cfoutput>#answer#</cfoutput>

Expected Result: 5.0


Fork me on GitHub