+ Start a Discussion
Arup SarkarArup Sarkar 

Calling Apex WS from java client

Hi I have the following web service in Apex.


global class AccountWebService
    webService static Id makeAccount(String AccountName)
        Account acct = new Account();
        acct.Name = AccountName;
        insert acct;
        return acct.Id;


 I have created the following java client in java.


package com.nb.sfdc.ws.client;

import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;

import org.apache.axis.AxisFault;

import com.sforce.soap.schemas._class.AccountWebService.AccountWebServiceBindingStub;
import com.sforce.soap.schemas._class.AccountWebService.AccountWebServiceServiceLocator;

public class TestWSClient {

	 * @param args
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.setProperty("http.proxyHost", "xxxxx");
		System.setProperty("http.proxyPort", "80");
		AccountWebServiceServiceLocator loc = new AccountWebServiceServiceLocator();
		try {
			URL url = new URL(loc.getAccountWebServiceAddress());
			AccountWebServiceBindingStub stub = new AccountWebServiceBindingStub(url,loc);
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			System.out.println("MalformedURLException: " + e.toString());
		} catch (AxisFault e) {
			// TODO Auto-generated catch block
			System.out.println("AxisFault: " + e.toString());
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			System.out.println("RemoteException: " + e.toString());



 I am getting the following error.


AxisFault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session


Can someone please help me.


Arup SarkarArup Sarkar

I posted the topic in Java Development