10.07.2015 Views

SuiteTalk (Web Services) Platform Guide - NetSuite

SuiteTalk (Web Services) Platform Guide - NetSuite

SuiteTalk (Web Services) Platform Guide - NetSuite

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Web</strong> <strong>Services</strong> Operationslogin197}role.internalId = _dataCollection["login.roleNSkey"];passport.role =role;passport.account= _dataCollection["login.acct"];}}// Login to <strong>NetSuite</strong>_out.info( "\nLogging into <strong>NetSuite</strong>" );_out.info( "Username: " + passport.email );_out.info( "Account: " + passport.account );Status status = (_service.login( passport )).status;// Process responseif ( status.isSuccess == true ){_isAuthenticated = true;_out.info( "\nThe user with nsKey=" + _service.sessionInfo.userId + " was loggedin successful and a new session has been created." );}else{// Should never get here since any problems with the// login should have resulted in a SOAP fault_out.error( getStatusDetails( status ) );}Javapublic void login(boolean isAuto) throws RemoteException {if (!_isAuthenticated) {// Check whether this is a forced login as part of another operationif (isAuto)_console.writeLn("\nYou need to first login before invoking this operation ...");// Populate Passport object with all login informationPassport passport = new Passport();RecordRef role = new RecordRef();// Determine whether to get login information from config// file or prompt for itif ("true".equals(_properties.getProperty("promptForLogin"))) {_console.writeLn("\nPlease enter your login information: ");System.out.print("E-mail: ");passport.setEmail(_console.readLn());System.out.print("Password: ");passport.setPassword(_console.readLn());System.out.print("Role nsKey (press enter for default administrator role): ");role.setInternalId(_console.readLn());passport.setRole(role);System.out.print("Account: ");passport.setAccount(_console.readLn());} else {passport.setEmail(_properties.getProperty("login.email"));passport.setPassword(_properties.getProperty("login.password"));role.setInternalId(_properties.getProperty("login.roleNSkey"));<strong>SuiteTalk</strong> <strong>Platform</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!