Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ColdFusion 9 calling .NET Web Service- Web service operation with parameters cannot be found. HELP!

Error: Web service operation .... with parameters {part={...},storeId={...},contractId={...}} cannot be found.

I created a .NET web service that talks to a ColdFusion page. What happens is when the user types a part number into the part number field then tabs out of it, the web service is called to get the appropriate pricing for that part. How it gets the pricing is done behind the scenes, is irrelevant, and is too complicated to show on here for the sake of the point I'm trying to get across.

Here's what I got going on- I have the ColdFusion page passing in 3 variables: part, storeId, and 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>

Before, I just had the contractId and the part being passed in, and it worked great. No problems. But since I added in the storeId, it's throwing this error message up:

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 : 

As you can see it's getting the values I'm passing in just fine.

What I made sure of:

  1. I made sure that the web service address indicated above was current (meaning, I made sure that it was the latest build that contained my new parameter).

  2. I manually go to the web service, and the wsdl shows up (as expected).

  3. I can manually invoke the web service as well by going to the web service URL. I can enter in my 3 variables and click Invoke, and it returns the correct value.

Here's my web service code:

    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;
        }
    }

This goes out to the business object and does the work, and returns the result. Ultimately I think that this is a ColdFusion/.NET interoperability issue. Thoughts?

like image 777
Mike Marks Avatar asked Apr 06 '11 13:04

Mike Marks


2 Answers

What about adding refreshwsdl="true" to your call?

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

Otherwise put a dump of the wsdl here.

like image 32
Cyril Hanquez Avatar answered Nov 14 '22 09:11

Cyril Hanquez


Webservices can cache in CFAdmin; login to CFAdmin and go to Webservices and locate the webservice entry pointing to your WSDL, locate and click the refresh button for this entry, that should do the trick. Sometimes I've had to delete the webservice entry and had to re-add it.

like image 59
Stefano D Avatar answered Nov 14 '22 07:11

Stefano D