Use the RestSession.startSession() method to start a REST session without authenticating the client. You can log into the REST server after you start the session if that is required.

Note: Starting a session without logging in will not give your REST client access to secured Oracle ATG Web Commerce resources.

The following sample program starts a REST session using the startSession() method.

public class RestClientStartSession {
  // Use your own hostname and port.
  private String mHost = "myserver";
  private int mPort = 9876;
  private RestSession mSession = null;
  public RestClientStartSession() {}

  protected void execute() throws RestClientException {

    // Create a RestSession object. Use the constructor that
    // takes only the REST server host and port.
    mSession = RestSession.createSession(mHost, mPort);

    // Invoke the startSession() method.

    // Verify that the session is started.
    String sessionid = mSession.getSessionId();
    System.out.println("The session ID is: " + sessionid);

    // perform unsecured operations or login here
    // forexample:
    // mSession.login("myusername","mypassword")

  public static void main(String[] args) {
    RestClientStartSession sample = new RestClientStartSession();
    try {
    catch (Throwable t) {

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices