You need to sign in to do that
Don't have an account?
"No service available for class" error message ?
After trying to execute the "webServiceName" web service below, I get this error:
ERROR: ........... {faultcode:'soapenv:Client', faultstring:'No service available for class 'MyClass'', }
Here's my button code:
{!requireScript("/soap/ajax/16.0/connection.js")}
{!requireScript("/soap/ajax/16.0/apex.js")}
var args = {
objId:'{!MasterObject__c.Id}',
childIds:{!GETRECORDIDS($ObjectType.ChildObject__c)}
};
function callback(result) { location.href=result.pagereference; }
var result = sforce.apex.execute('MyClass', 'webServiceName', args, callback);
Here's my service code:
global with sharing class MyClass
webservice static wsResult webServiceName(String objId, String[] childIds) {
// Do stuff...
wsResult result = new wsResult();
result.pagereference = pr.getUrl();
result.success = true;
result.errorCode = 0;
result.errorMsg = '';
return result;
}
global class wsResult {
webservice string pagereference;
webservice boolean success;
webservice Integer errorCode;
webservice String errorMsg;
public wsResult() {}
public wsResult(string url, boolean result, Integer code, String msg) {
this.pagereference = url;
this.success = result;
this.errorCode = code;
this.errorMsg = msg;
}
}
I looked in my Enterprise WSDL, and couldn't find my service -- but I'm a complete novice with WSDLs...
Thanks in advance!
Is the webservice in a package? You'll need to add the package prefix to the name of the class if it is. I think for a package "mypkg" it would be
You might also try doing the call without the callback. e.g.
All Answers
You have "with sharing" in the class definition ... maybe the user you're seeing the error for hasn't been granted access to your class?
Ron
Nope. :(
Running this as the administrator user -- and removed "with sharing".
Is the webservice in a package? You'll need to add the package prefix to the name of the class if it is. I think for a package "mypkg" it would be
You might also try doing the call without the callback. e.g.
Still nothing.
Error message is still:
"No service available for class 'mypkg.MyClass__c'"
Worked!
In my original code, I had accidentally left off the "__c" in the web service name. I had "fixed" it, but then tried removing it and now it works.
So the AJAX call is:
{!requireScript("/soap/ajax/16.0/connection.js")}
{!requireScript("/soap/ajax/16.0/apex.js")}
var args = {
objId:'{!mypkg__MasterObject__c.Id}',
childIds:{!GETRECORDIDS($ObjectType.mypkg__ChildObject__c)}
};
var result = sforce.apex.execute('mypkg/MyClass', 'webServiceName', args, null, false);
location.href=result.pagereference;
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>No service available for class 'XX_XXX_Event_Processing_Web_Service.'</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>