You need to sign in to do that
Don't have an account?

S-Control fails to call Web Service - No service available for class 'myWSApi",
S-Control:
var result = sforce.apex.execute('myApiWs', 'Xlogin', {customer:'SF', login:'Bob', pw:'Smith'});
Code:
global class myApiWs
{
WebService static String Xlogin(String customer, String login, String pw)
{
return 'Customer=' + customer + ' Login=' + login;
}
}
{
WebService static String Xlogin(String customer, String login, String pw)
{
return 'Customer=' + customer + ' Login=' + login;
}
}
I have an S-Control that yields the error "No service available for class 'myApiWS", " when an attempt is made to call this Web Service. Any idea why?
Chris
Those who need help: you need to prefix class with namespace: YourNamespace.YourClass
All Answers
Same error attempting to call the sample HelloWorld2 web service from the sample HelloWorld S-Control!!!
.... faultstring:'No service available for class 'HelldWorld2", }
Is there some sort of developer account setting that expires? All this code use to work fine...
Chris
<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/10.0/connection.js"></script>
<script src="/soap/ajax/10.0/apex.js"></script>
<script>
function demo()
{
try
{
// The apex.execute() command in the AJAX Toolkit
// allows the s-control to access the specified
// Apex class and method.
var result = sforce.apex.execute('HelloWorld2' , 'sayHelloWorld', {arg:"new Apex user!"});
document.getElementById('userNameArea').innerHTML = 'Congratulations! ' + result;
}
catch(error)
{
alert(error);
}
}
</script>
</head>
<body onload=demo()>
<div id=userNameArea>
</div>
</body>
</html>
global class HelloWorld2 {
// The WebService keyword makes this a public
// WebService method. WebService methods must
// always be static, and must also be contained
// in a global class.
WebService static String sayHelloWorld(String arg) {
return 'Hello ' + arg;
}
// The following is a simple unit test for the
// sayHelloWorld method. Unit test methods take
// no arguments, commit no data to the database,
// and are flagged with the testMethod keyword
// in the definition.
static testMethod void testHelloWorld() {
System.assertEquals('Hello to you!', sayHelloWorld('to you!'));
}
}
i'm not sure what is going on, but your developer edition may have some permissions or settings which are defeating this otherwise correct code.
do you see the WSDL link for this class when you view the apex code details list in the setup-build area?
Yes I have Edit, Del, WSDL, Security links next to all my Apex Code. Security is set to System.Administrator.
Don't know if or how this could be related, but last week I àGranted Login Accessà to SF support to assist me on publishing my application.
Chris
Nope, there is no namespace. The code looks pretty much is as I have posted.
This most be some sort of Developer Account setting issue. I think I will create myself another dev acct and go from there. Thanks for your support and let me know if you think of any other possibility.
Chris
Created myself a new developer account. Copied Code and S-Control and created a new Tab to host the S-control, and ... yes, it works now! So there is something different in my initial developer account... but what?
I have compared both dev accts and nothing stands out as being a problem. However, I did see a couple minor items that might be a clue;
1) Old dev acct logo says SalesFore SFA 7 and new dev acct logo says SalesForce SFA 8
2) New dev acct offers 11.0 or 10.0 versions of Code, but old dev acct only offers 10.0
Is this versioning difference causing my problem? Is there a setting somewhere to let me upgrade my old dev acct to SalesForce SFA 8?
Chris
<soap:address location="..." />
My guess is that you have defined a namesapce for old DE account.
Those who need help: you need to prefix class with namespace: YourNamespace.YourClass