在 ColdFusion 中应该使用什么来映射到 SOAP 类型 tns:ArrayOfString? [英] What should be used in ColdFusion to map to SOAP type tns:ArrayOfString?

查看:17
本文介绍了在 ColdFusion 中应该使用什么来映射到 SOAP 类型 tns:ArrayOfString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果一个 cfinvoke 一个参数类型设置为 tns:ArrayOfString 的 SOAP 网络服务,一个人将得到:

If one cfinvoke a SOAP web service with param type sets to tns:ArrayOfString, one will get:

无法执行 Web 服务调用 Hello.故障返回时调用web服务操作是:''java.lang.IlligalArgumentException: 参数类型不匹配

Cannot perform web service invocation Hello. The fault returned when invoking the web service operation is: ''java.lang.IlligalArgumentException: argument type mismatch

如何调用 tns:ArrayOfString 类型的 Web 服务?

How to invoke a web service with type tns:ArrayOfString?

根据 http://forums.adobe.com/message/4337438

这有效:

<cfscript>
     root = structnew();
     text = arraynew(1);
     text[1] = "Hello";
     text[2] = "world";
     root.string=text;
</cfscript>

<cfinvoke method="Hello"
  webservice="http://localhost/Service1.asmx?wsdl"
  returnvariable="response">
     <cfinvokeargument name="array" value=#root#/>
</cfinvoke>

现在的问题是,为什么这行得通?

now the question is, why does this work?

推荐答案

就像我在您引用的主题中提到的那样,有 没有ArrayOfString 的直接映射.所以它本质上被视为一种结构,就像任何其他复杂类型一样.如果您查看 wsdl,ArrayOfString 包含一个名为 string 的键,其值是一个 type="s:string" 数组:

Like I mentioned in the thread you referenced, 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 named string, whose value is an array of type="s:string":

<s:complexType name="ArrayOfString">
   <s:sequence>
     <s:element minOccurs="0" maxOccurs="unbounded" 
           name="string" nillable="true" type="s:string" /> 
   </s:sequence>
</s:complexType>

所以 CF 代码有效,因为它创建了一个具有正确键名(string)和值类型(字符串数组)的结构.

So the CF code works because it creates a structure with the correct key name (string) and value type (array of strings).

    root.string = [ arrayOfStrings ];

这篇关于在 ColdFusion 中应该使用什么来映射到 SOAP 类型 tns:ArrayOfString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆