• skrish
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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