cfinvokeargument上的Coldfusion WSDL IllegalArgumentException [英] Coldfusion WSDL IllegalArgumentException on cfinvokeargument

查看:95
本文介绍了cfinvokeargument上的Coldfusion WSDL IllegalArgumentException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您调用Web服务的方法并且想要省略具有默认值集的不需要的数字变量Coldfusion时,将引发以下错误:

When you are calling a method of a webservice and want to omit an unrequired numeric variable that has a default value set coldfusion will throw the following error:

The fault returned when invoking the web service operation is:<br>
<pre>'' java.lang.IllegalArgumentException</pre>

示例:

<cfinvoke
    webservice = "http://*.cfc?WSDL" 
    method="getFriendlyDay" 
    returnvariable="response"
    refreshWSDL="true"
>
        <cfinvokeargument name="dayNumber" omit="true"/>
</cfinvoke>

网络服务组件:

<cffunction name="getFriendlyDay" access="remote" returntype="any" output="no" description="get a friendly date from a number">   

        <cfargument name="dayNumber" type="numeric" required="no" default="0">
        ...
</cffunction>


推荐答案

我的解决方案是不忽略该参数。传递默认值。我只是想记录下来,以防其他人遇到相同的错误。到目前为止,它仅在数值上发生。

My solution to this is to just not omit the argument. Pass in the default value. I just wanted to record this in case someone else gets the same error. Thus far it has only occurred on numeric values.

<cfinvoke
    webservice = "http://*.cfc?WSDL" 
    method="getFriendlyDay" 
    returnvariable="response"
    refreshWSDL="true"
>
        <cfinvokeargument name="dayNumber" value="0" >
</cfinvoke>

更新:

我认为这可能与此处概述的错误有关:


在远程服务中Coldfusion处理可选参数的方式是
,它允许调用客户端传递空值。在
文档/文字或rpc /编码的WSDL描述中,除非
指定 nillable ='false',否则元素可以接受null。从Coldfusion生成的
WSDL不使用 nillable ='false'或 minOccurs ='0'
,它指示客户端必须包括参数和
都可以

The way Coldfusion handles optional arguments as a remote service is that it allows the calling client to pass in a null value. In a document/literal or rpc/encoded WSDL description, an element can accept null unless it specifies "nillable='false'". The generated WSDLs from Coldfusion do not use "nillable='false'" or "minOccurs='0'" which instructs the client that they must include the parameter and that it is ok to pass in a null value.

但是,问题在于
是可选的数字或布尔参数类型将抛出非法参数异常 当被试图显式传递null的客户呼叫
时……

The problem however is that "numeric" or "boolean" argument types that are optional will throw an "Illegal Argument Exception" when being called by a client who is trying to explicitly pass in null ...

这篇关于cfinvokeargument上的Coldfusion WSDL IllegalArgumentException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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