2011-04-06 17 views
5

錯誤:無法找到帶有參數{part = {...},storeId = {...},contractId = {...}}的Web服務操作....調用.NET Web Service的ColdFusion 9 - 無法找到帶參數的Web服務操作。幫幫我!

我創建了一個.NET Web服務,與ColdFusion頁面交談。當用戶在零件號字段中輸入零件號然後選中它時,會調用Web服務以獲得該零件的適當定價。它如何得到定價在幕後完成,是無關緊要的,而且爲了我想要達到的目的,這裏顯得太複雜了。

這是我竟能導通我有ColdFusion頁傳遞3個變量:部分STOREID,並contractId

<cfset vars = structNew()> 
<cfset vars["contractId"] = "#Trim(Attributes.contract)#"> 
<cfset vars["part"] = "#Trim(Attributes.part)#"> 
<cfset vars["storeId"] = "#Trim(Attributes.store)#"> 

<cfinvoke webservice = "http://compassnetdev/Services/CustomerContractPartPrice.asmx?wsdl" 
      method = "GetCustomerContractPrice" 
      returnVariable = "price" 
      argumentCollection = "#vars#"> 
</cfinvoke>

之前,我剛結束了contractId部分傳遞中,和它的工作很大。沒問題。但自從我在STOREID補充,它拋出此錯誤消息了:

 
Error Occurred While Processing Request 
Web service operation GetCustomerContractPrice with parameters {part={BV410070},storeId={001},contractId={21}} cannot be found. 


The error occurred in C:\inetpub\wwwroot\CustomTags\fn_get_price_2.cfm: line 58 

56 :   method = "GetCustomerContractPrice" 
57 :   returnVariable = "price" 
58 :   argumentCollection = "#vars#"> 
59 : 
60 : 

正如你可以看到它變得我傳遞就好值。

我確信的:

  1. 我確信上面指出的Web服務地址是電流(意思是,我確信,這是包含我的新參數的最新版本)。

  2. 我手動轉到Web服務,並顯示wsdl(如預期)。

  3. 我可以通過轉到Web服務URL來手動調用Web服務。我可以輸入3個變量並單擊Invoke,並返回正確的值。

這裏是我的web服務代碼:

 public class CustomerContractPartPrice : System.Web.Services.WebService 
    { 
     [WebMethod] 
     public decimal GetCustomerContractPrice(string part, string storeId, int contractId) 
     { 
      var context = new PricingBLL(); 
      decimal price = context.GetCustomerContractPartPrice(contractId, part, storeId); 
      return price; 
     } 
    }

這是寫給業務對象和做的工作,並返回結果。最終我認爲這是一個ColdFusion/.NET互操作性問題。思考?

回答

4

怎麼樣加入refreshwsdl = 「true」 以你的電話嗎?

<cfinvoke webservice = "http://compassnetdev/Services/CustomerContractPartPrice.asmx?wsdl" 
      method = "GetCustomerContractPrice" 
      returnVariable = "price" 
      argumentCollection = "#vars#" 
      refreshwsdl="true"> 

否則就把WSDL的傾倒在這裏。

5

Webservices可以在CFAdmin中緩存;登錄到CFAdmin並轉到Webservices並找到指向WSDL的web服務條目,找到並單擊此條目的刷新按鈕,這應該可以做到。有時我不得不刪除web服務條目並重新添加它。

+0

太棒了,我認爲這是我的問題的根源!感謝您的迴應。當我發現答案時,請參閱上面的答案! – 2011-04-06 13:59:05

0

我找到了解決方案!問題在於ColdFusion緩存了WSDL文件。所以如果你改變了參數集合(就像在我的例子中那樣,我添加了一個storeId變量,我必須重新啓動ColdFusion服務(ColdFusion 9 Application Server)才能得到WSDL的新副本,這是ColdFusion的錯誤。

+2

我認爲refresh =「wsdl」可能會訣竅。測試它,讓我知道... – 2011-04-06 14:00:53

+0

@CyrilHanquez是的,工作。 – 2013-06-18 19:06:47