在ColdFusion中应该使用什么来映射到SOAP类型tns:ArrayOfString? [英] What should be used in ColdFusion to map to SOAP type tns:ArrayOfString?
问题描述
如果一个 cfinvoke
具有param类型设置为 tns:ArrayOfString
的SOAP Web服务,将会得到: / p>
If one cfinvoke
a SOAP web service with param type sets to tns:ArrayOfString
, one will get:
无法执行Web服务调用您好。
调用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服务根据 http://forums.adobe.com/message/4337438
This works:
This works:
<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 的78b2.html =nofollow>无直接映射。因此,它基本上被视为一个结构,就像任何其他复杂类型。如果你看看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屋!