cancel
Showing results for 
Search instead for 
Did you mean: 

SFAPI not working in JAVA project

martingibson
Explorer
0 Kudos

I have imported the WSDL from SuccessFactors (https://performancemanager.successfactors.eu/sfapi/v1/soap12?wsdl) 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.setCompanyId(companyID);

sFCredential.setUsername(userId);

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.

Accepted Solutions (0)

Answers (0)