Skip to main content
Participant
January 12, 2009
Question

How do you format a complex data type for a web service?

  • January 12, 2009
  • 3 replies
  • 537 views
Hi, I am getting an error message that seems to be well documented on the web, but I can't seem to find any information about how to resolve it. I am trying to pass an array to a web service but I get the error message:

Web service operation with parameters cannot be found.

I am formatting my array like this:


<cfset arrayResidueTests = ArrayNew(1)>
<cfset structResidueTest = StructNew()>


<cfif arguments.qryBatch.recordcount GT 0>

<cfloop query="arguments.qryBatch">

<cfset structResidueTest.Label = NIRCal>
<cfset structResidueTest.KPIN = Left(GrowerNumber,4)>
<cfset structResidueTest.ResidueTypeCode = 'O'>
<cfset structResidueTest.CollectionDate = DateFormat(SampCollectDt,'dd-mm-yyyy')>
<cfset structResidueTest.DispatchDate = DateFormat(IntendHarvDt,'dd-mm-yyyy')>

<cfscript>
ArrayAppend(arrayResidueTests, structResidueTest);
</cfscript>

</cfloop>

</cfif>

<cfdump var="#arrayResidueTests#">

and I invoke the web serivce like this:

<cfinvoke webservice="https://mobiledatacapture.zespri.com/agfirst.asmx?wsdl"
method="SubmitResidueTests"
returnvariable="local.retVar">

<cfinvokeargument name="ResidueTests" value="#arrayResidueTests#">

</cfinvoke>


and finally, this is the wsdl describing the web service:
https://mobiledatacapture.zespri.com/agfirst.asmx?wsdl

I have been talking directly to the (.NET) developers who built the web service but they haven't been able to give me any bright ideas either!! Hope someone can help me with this - any comments would be much appreciated.

Thank you.
    This topic has been closed for replies.

    3 replies

    Inspiring
    January 13, 2009
    Have you tried running the WSDL through the WSDL2Java utility? Here is a good post to get you started: http://tjordahl.blogspot.com/2008/07/for-some-reason-i-havent-actually-even.html.
    MercuryNewt
    Participating Frequently
    January 13, 2009
    I've noticed that sometimes when accessing .NET web services with ColdFusion, you actually need to send a formatted SOAP message, rather than simply invoking the service. I had this issue when accessing SharePoint web services with CF. I'm not positive, but I believe the problem lies with the complex data types not matching up between CF and .NET. You may try creating an XML object/string from your array and send that to the .NET web service.

    Hope this helps...
    Inspiring
    January 12, 2009
    I'd look at two things. The first is that sending an array that contains a structure seems redundant. Why not just send an array with the elements in the expected order.

    The second is the use of dateformat. It returns a string and the wsdl says the method is expecting a datetime object.