Skip navigation
Currently Being Moderated

CF gets illegalArgumentException: argument type mismatch calling webservice

Jul 23, 2009 10:13 AM

We are a small team struggling with interoperability. We need CF MX7 code to call a webservice written with .Net. Our .NET guy knows nothing about ColdFusion and our CF folks don't know .NET. We've gotten past some authentication issues and now we are able to consume a "basic" webmethod called UploadFileBasic. It expects only 4 simple arguments, all of which are just strings. Now we're trying to do the "real" task which is call the UploadFile method. It expects the same 4 simple strings plus a 5th argument which is an array of strings (i.e. name - value pairs we call MetaData).


Here is a link to the WSDL for this:


Please take note of the complex type called ArrayOfMetaData:


Here is the component "metadata" code:


<cfcomponent  output="false">

      <cfproperty  name="name" type="string" /> 

               <cfproperty name="value" type="string" />



Here is the CFM code:

<cffile  action="readBinary"




        <cfset b64file =  #toBase64(objBinaryData)#>

        <cfset b64fileName =  #form.inputFileNM#>

        <cfset strTrimURL =  "trim/trimWSdev/trim.asmx">

        <cfset strDocument =  "Document">




MetaData = ArrayNew(1);

StructInsert(MetaStruct,  "_MetaData", MetaData);     

MetaData[1] =  createObject("component","MetaData");

MetaData[1].name =  "recAuthorLoc";

MetaData[1].Value = "Doe,  John";

MetaData[2] =  createObject("component","MetaData");

MetaData[2].name =  "udf:OPEAnalyst";

MetaData[2].Value = "Tiger  Woods";


ws = CreateObject("webservice",  "");



recordNumber=ws.UploadFile("#strTrimURL#","#objBinaryData#",  "#b64fileName#", "#strDocument#", "# MetaStruct#");




The runtime results we get are like this:


Error occurred while processing Request

Could not perform web service invocation "UploadFile"


Here is the fault returned when invoking the web service operation:

    java.lang.IllegalArgumentException: argument type mismatch


The line number points to the line:


recordNumber=ws.UploadFile("#strTrimURL#","#objBinaryData#",  "#b64fileName#", "#strDocument#", "#MetaStruct#");


We get the same failure when this line uses this alternative:


recordNumber=ws.UploadFile("#strTrimURL#","#objBinaryData#",  "#b64fileName#", "#strDocument#", "#MetaData#");


We had a post on HouseOfFusion for several days on this issue and nobody answered so we are really desparate for some ideas at this point. Thank you very much in advance.

  • Currently Being Moderated
    Jul 24, 2009 12:03 PM   in reply to jjamjatra

    Two ideas.

    Have you tried just doing a struct instead of the component?

    MetaData = ArrayNew(1);

    StructInsert(MetaStruct,  "_MetaData", MetaData);     

    MetaData[1] =  StructNew();

    MetaData[1].name =  "recAuthorLoc";

    MetaData[1].Value = "Doe,  John";


    Another way to go about this (perhaps you have tried) is to get sample .Net code that consumes the web service and translate that to CF.


    Concerning passing MetaStruct vs MetaArray, if it is expecting an array I would think you need to pass MetaArray.


    A link that may be helpful:


    Good luck.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points