• dumplingdude
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

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.

 

 

 

 

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.