function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WhyserWhyser 

Problem trying to invoke APEX webservice from .NET

I've created a very very simple webservice using eclipse just to test to see how this works (exists only on the test environment sandbox right now)
 
Code:
global class testWebServiceClass 
{
 webService static Id generateEmptyQuoteTest( Id OpportunityId )
 {
  Quote__c q = new Quote__c ( Opportunity__c = OpportunityId, Date_Sent__c = DateTime.now() );
  insert q;
  return q.id;
  
 }
}

 
Now I've tried invoking this using s-control in the opportunity detail page button
Code:
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")} 

var id = sforce.apex.execute( "testWebServiceClass","generateEmptyQuoteTest",{OpportunityId:"{!Opportunity.Id}"}); 

window.location.reload();

 and this works perfectly.
 
However, I'm also trying to see if I can invoke the webservice from a C# application (the project consumed the enterprise.wsdl generated from test.salesforce.com and the wsdl for the APEX class above, calling the web reference testWebService)
Code:
    protected void Button1_Click(object sender, EventArgs e)
    {
        testWebService.testWebServiceClassService test = new testWebService.testWebServiceClassService();
        test.SessionHeaderValue = new testWebService.SessionHeader();
        test.SessionHeaderValue.sessionId = sfdc.SessionHeaderValue.sessionId;
        test.Url = sfdc.Url;
        String testResult = test.generateEmptyQuoteTest("006S0000002K6i0");
        Response.Write(testResult);
    }

 where the sfdc object already has a valid login session header.
 
The part I bolded always runs into an exception:
"No operation available for request
{http://soap.sforce.com/schemas/class/testWebServiceClass}generateEmptyQuoteTest"
 
So I was wondering if anyone can tell me where I'm going wrong? I tried reading through the documentation but I guess I either missed something or I don't understand this stuff to well... please help!!

 
SuperfellSuperfell
dont change the Url property.
WhyserWhyser
Thanks SimonF, that worked like a charm.