Skip to content

Instantly share code, notes, and snippets.



Last active Sep 6, 2015
What would you like to do?
SOAP web service with optional arguments
<!--- --->
<cfcomponent output="false">
<cffunction name="myFunc" returntype="struct" access="remote">
<cfargument name="mParam" type="numeric" required="true">
<cfargument name="oParam" type="string" required="false" default="strDefault">
<cfreturn Arguments>
<!--- only works when both cfinvokeargument tags are present --->
<cfinvoke method="myFunc" webservice="http://tester002/webservice.cfc?wsdl" returnvariable="ws">
<cfinvokeargument name="mParam" value="1">
<cfinvokeargument name="oParam" value="1">
<cfdump var="#ws#">
// works if only one argument is present
$requestParams = array(
'mParam' => 2
try {
$client = new SoapClient('http://tester002/webservice.cfc?wsdl');
$response = $client->myFunc($requestParams);
} catch( Exception $ex ) {
var_dump( $ex );
' works if only one parameter is set
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim c = New webservice001.webservice.webservicecfcPortTypeClient("webservice.cfcHttpSoap12Endpoint")
Dim r As New webservice001.webservice.myFuncRequest
r.mParam = 1
Dim resp = c.webservice_webservicecfcPortType_myFunc(r)
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment