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="");

cfinvoke Attribute Reference

component

String or component object; a reference to a component, or
component to instantiate.

method
Required

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

returnvariable

Name of a variable for the invocation result.

argumentcollection

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

username

Overrides username specified in Administrator > Web Services

password

Overrides passowrd specified in Administrator > Web Services

webservice

The URL of the WSDL file for the web service.

timeout

The timeout for the web service request, in seconds

proxyserver

The proxy server required to access the webservice URL.

proxyport

The port to use on The proxy server.

proxyuser

The user ID to send to the proxy server.

proxypassword

The user's password on the proxy server.

serviceport

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
Default: NO

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

wsdl2javaargs

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

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