Skip to Content

SFAPI not working in JAVA project

Jan 19, 2017 at 10:37 AM


avatar image
Former Member

I have imported the WSDL from SuccessFactors ( into a JAVA project. I generated the methods using maven and it created SFAPIService12CallbackHandler, SFAPIService12Stub and SFWebServiceFaultException classes which is all good.

i have added the following code into my JAVA:

try { SFAPIService12Stub sFAPIService12Stub = new SFAPIService12Stub();

// Create and process login

SFCredential sFCredential = new SFCredential();



sFCredential.setPassword(password); Options options = sFAPIService12Stub._getServiceClient().getOptions();

options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.FALSE);

options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.FALSE);

options.setProperty(HTTPConstants.CHUNKED,false); Login login0 = new Login();

login0.setCredential(sFCredential); LoginResponse response = sFAPIService12Stub.login(login0);

// Process Update

Update update30 = new Update();

update30.setType(type); update30.setSfobject(processHiresUpdate(newHiresForXMLLoad));

UpdateResponse ur = sFAPIService12Stub.update(update30);

// Create and process logout

Logout logout4 = new Logout();

LogoutResponse logout = sFAPIService12Stub.logout(logout4);

} catch (AxisFault e)

{ e.printStackTrace(); }

catch (RemoteException e)

{ e.printStackTrace(); }

catch (SFWebServiceFaultException e)

{ e.printStackTrace(); }

The login and log out both work fine but when i add the update in and run it i get the followling error:

"SFWebServiceFaultException: Invalid SFAPI session!"

When looking around i find solutions for PI and im struggling with this from a java perspective.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers