• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF gets illegalArgumentException: argument type mismatch calling webservice

Guest
Jul 23, 2009 Jul 23, 2009

Copy link to clipboard

Copied

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:

<s:element name="UploadFile">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="trimURL" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="incomingArray" type="s:base64Binary" />
            <s:element minOccurs="0" maxOccurs="1" name="FileName" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="TrimRecordTypeName" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="metaDataArray" type="tns:ArrayOfMetaData" />
          </s:sequence>
        </s:complexType>
</s:element>
      <s:complexType name="ArrayOfMetaData">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="MetaData" nillable="true" type="tns:MetaData" />
        </s:sequence>
      </s:complexType>

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.

TOPICS
Advanced techniques

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

LATEST

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:

http://www.coldfusionmuse.com/index.cfm/2009/4/27/array.CF.to.NET

Good luck.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation