• Alan Tang
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have created a S-Control for converting leads, and want to popup another S-Control for searching company from the convert leads S-Control.
 
Not sure if it is possible? If not, can we find other way to implement this?

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.

 

 

 

 

Hi, everyone!

I'm trying to access to a web service written in Apex. It's very simple as follwing ;

|  global class MyHello {
|      webService static String getHello(String yourName) {
|          return 'Hello, ' + yourName + '!!';
|      }
|  }

I'm using axis-1.4, and I generate stubs with the following command.

|  java org.apache.axis.wsdl.WSDL2Java -a .\MyHello.xml

where MyHello.xml is gotten from Visualforce.com UI.

Then, I write the following client code ;

|  package com.sforce.soap.client;
|  import com.sforce.soap.schemas._class.MyHello.*;
|
|  public class MyHelloClient {
|      public static void main(String[] args) {
|         try {
|              MyHelloService mhs = new MyHelloServiceLocator();
|              MyHelloPortType mh = mhs.getMyHello();
|              System.out.println("GREETING : " + mh.getHello("FooBar"));
|         }
|          catch(Exception e){
|              e.printStackTrace();
|         }
|      }
|  }

This failes with following exception.

|  AxisFault
|   faultCode: {http://soap.sforce.com/schemas/class/MyHello}INVALID_SESSION_ID
|   faultSubcode:
|   faultString: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
|   faultActor:
|   faultNode:
|   faultDetail:
|      {http://xml.apache.org/axis/}stackTrace:INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session

"Quick Start" in "Force.com Web Services API Developer's Guide" shows me a sample program to login and set session id.
But I couldn't understand how to implement setting sessionId with the stubs of my custom web service.

If anyone know about this issue, please show me the right way.

thanks.

  • September 30, 2008
  • Like
  • 0