You need to sign in to do that
Don't have an account?
Apex WebService
Please help, I am new to salesforce but I have done some work with webservices before. I am running into a problem accessing an Apex webservice.
Apex Class
Global class TestSOA {
Webservice static void testService(){
List<account> newAccts = new List<account>();
Account oneAccount = new Account();
oneAccount.Name = 'Test 1';
newAccts.add(oneAccount);
oneAccount.Name = 'Test 2';
newAccts.add(oneAccount);
}
}
My Code
TestSOAServiceLocator service = new TestSOAServiceLocator();
TestSOABindingStub sb = new TestSOABindingStub(service);
SessionHeader sh = new SessionHeader();
sh.setSessionId(lr.getSessionId());
sb.setHeader(new TestSOAServiceLocator().getServiceName().getNamespaceURI(),"SessionHeader", sh);
sb._setProperty(TestSOABindingStub.ENDPOINT_ADDRESS_PROPERTY, lr
.getServerUrl());
sb.testService();
I read the documentation but I didn't find anything about authenticating for an Apex Webservice, my method seems to work but i am getting this error now:
"No operation available for request {http://soap.sforce.com/schemas/class/TestSOA}testService"
Thanks in advance.
Don't change the endpoint URL property.
Thanks. It works.
I had some issue, but after removed this line for endpoint, it doesnot work, i met error "No endpoint".
please help~