While invoking the Webservice API for the GetTablesBin
method, I'm getting the error Web service operation GetTablesBin with parameters cannot be found.
Webservice Calling code
<cfinvoke
webservice="http://www.argusmedia.com/ArgusWSVSTO/ArgusOnline.asmx?wsdl"
method="GetTablesBin"
returnvariable="binResponse">
<cfinvokeargument name="authToken" value="#AuthToken#"/>
<cfinvokeargument name="tableNames" value="#tablename#"/>
</cfinvoke>
I can see the method running fine using the SOAPUI
client.
While digging further, found the method class to be missing in the Coldfusion stubs folder as well.
Any pointers would be really helpful?
Web service operation GetTablesBin with parameters {...} cannot be found.
Notice it says "with parameters"? Subtle difference, but it either means a) the method does not exist at all OR b) it does exist, but is receiving the wrong number or type of arguments. In this case the problem is "b)".
When troubleshooting web service issues, it is often helpful to create an instance of the web service, then dump that object to see which arguments the method requires. According to CF11, the "GetTablesBin" method expects two arguments: a String
and an ArrayOfString
. However, the current code passes in two String
's. Hence the error.
Code:
<!--- Add {refreshWSDL=false} if needed --->
<cfset ws = createObject("webservice"
, "http://www.argusmedia.com/ArgusWSVSTO/ArgusOnline.asmx?wsdl")>
<cfset writeDump(ws)>
Dump:
An ArrayOfString
is a slightly strange beast:
... there is no direct mapping of
ArrayOfString
. So it is essentially treated as a structure, just like any other complex type. If you look at the wsdl, ArrayOfString contains a single key namedstring
, whose value is an array oftype="s:string"
:
To resolve the error, simply create a structure with the proper key and pass it into the cfinvoke call. (Though personally I prefer createObject()
which is a little less bulky IMO)
<cfset arrayOfStrings = ["tableName1","tableName2"] />
<cfset tableNames.string = arrayOfStrings />
<cfinvoke ....>
<cfinvokeargument name="authToken" value="#AuthToken#"/>
<cfinvokeargument name="tableNames" value="#tableNames#"/>
</cfinvoke>