使用ColdFusion webservice - 找不到具有参数{}的Web服务操作 [英] Consuming ColdFusion webservice - Web service operation with parameters {} cannot be found

查看:131
本文介绍了使用ColdFusion webservice - 找不到具有参数{}的Web服务操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试使用网络服务,我收到一个错误。

I am testing consuming a web-service and I'm getting an error.

这里是web服务组件:

Here is the web-service component:

<cfcomponent >
<cffunction name="listBooks" access="remote" returntype="string" output="no" >

    <cfquery name="getBooks" datasource="cfbookclub" >
        SELECT bookID, title, bookDescription, genre
        FROM books
        ORDER BY title desc
    </cfquery>

    <cfsavecontent variable="bookList" >
        <books>
            <cfoutput query="getBooks" >
            <book id="#getBooks.bookID#" >
                <title>#XMLFormat( getBooks.title )#</title>
                <description>#XMLFormat( getBooks.bookDescription )#</description>
                <genre>#XMLFormat( getBooks.genre )#</genre>
            </book>
            </cfoutput>
        </books>
    </cfsavecontent>

    <cfreturn bookList >
</cffunction>

<cfinvoke 
webservice="http://127.0.0.1/books.cfc?wsdl"
method="listBooks"
returnvariable="rawXMLBookList" >
</cfinvoke>

看起来很简单 - 当我遇到初始错误时,我实际上试图传递一个参数genre ,

Seems simple enough - I was actually trying to pass an argument "genre" when I got the initial error,

Web service parameter name category cannot be found in the provided parameters {genre}.

所以我删除了对参数的所有引用,STILL得到这个错误

So I removed all reference to arguments, and STILL get this error

Web service operation with parameters {} cannot be found. 

错误让它听起来像无法找到Web服务,但是如果我剪切和粘贴url到我的浏览器我得到期望的XML文档...

The error makes it sound like the web-service cannot be found, however if I cut and paste the url into my browser I get the expected XML doc...

在这个网站有另一个帖子,但问题是一个base64问题,我只是返回txt所以我不认为这是一个类似的问题,即使通过错误msg是类似的。

There was another post like this on this site, but the problem was a base64 issue, I'm just returning txt so I don't think it's a similar problem, even through the error msg is similar.

推荐答案

code> refreshWSDL 参数传递给您的< cfinvoke> 呼叫,看看是否有帮助。

Try adding the refreshWSDL argument to your <cfinvoke> call and see if that helps.

<cfinvoke 
    webservice="http://127.0.0.1/books.cfc?wsdl"
    method="listBooks"
    refreshwsdl="yes"
    returnvariable="rawXMLBookList"> 
</cfinvoke>

设置 refreshwsdl =yes WSDL文件并重新生成用于使用Web服务的工件。

Setting refreshwsdl="yes" reloads the WSDL file and regenerates the artifacts used to consume the web service.

请注意,您不希望为所有请求保留此设置。您只需要设置它一个请求刷新工件。然后,您应该将其更改回 refreshwsdl =no

Note you do not want to keep this setting for all of your requests. You just need to set it for one request to refresh the artifacts. Then you should change it back to refreshwsdl="no". Until you need it again.

以下摘录自 Charlie Arehart的博客关于 refreshWSDL 参数:


为什么要刷新网络服务元数据?

只是为了备份一会儿,这个问题源于CF的帮助。在对给定Web服务的第一次请求时,CF执行一些缓存以使未来的请求更快,而不是缓存Web服务方法的结果,而是基于Web服务本身的描述由CF使用的工件。

Just to back up for a moment, the problem stems from CF's attempt to help. On the first request for a given web service, CF does some caching to make future requests go faster, not caching the results of the web service method but rather the artifacts used by CF based on the description of the web service itself.

CF使用在第一次调用时报告的Web服务描述(WSDL),基于此创建一个Java代理/存根,然后它将重用于从CF到

CF uses the web service description (WSDL) reported at the time of that first call to create a java proxy/stub based on that, which it then reuses on future calls from CF to that web service.

如果/当Web服务元数据更改时出现此问题。 CF不会知道,并将继续使用旧的缓存代理/存根,如果不匹配由Web服务返回的新WSDL,您的长时间运行的代码可能会失败。

The issue arises if/when the web service metadata changes. CF won't know, and will continue to use the older cached proxy/stub, and your long-running code may fail if it doesn't match the new WSDL returned by the web service.

因此,我们需要一种方法来告诉CF刷新代理存根的缓存。

So we need a way to tell CF to refresh its cache of that proxy stub.

这个新功能当然是最简单的方法,但这不是唯一的方法。

This new feature is certainly the easiest way to make that happen, but it's not the only way.

这篇关于使用ColdFusion webservice - 找不到具有参数{}的Web服务操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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