1 Reply Latest reply: Jul 24, 2009 12:03 PM by mgw4jc RSS

    CF gets illegalArgumentException: argument type mismatch calling webservice

    jjamjatra

      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: http://64.8.203.115/fileservice.asmx?wsdl

       

      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" />

      </cfcomponent>

       

      Here is the CFM code:

      <cffile  action="readBinary"

                     file="#FileName#"

                     variable="objBinaryData">

       

              <cfset b64file =  #toBase64(objBinaryData)#>

              <cfset b64fileName =  #form.inputFileNM#>

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

              <cfset strDocument =  "Document">

       

      <cfscript>

      MetaStruct=StructNew();

      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",  "http://64.8.203.115/fileservice.asmx");

      ws.setUsername("ourdomain\someuser");

      ws.setPassword("password");

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

                             

      </cfscript>        

       

      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.