Application Programming Interface Guide > Web Services Operations > Operations Reference > beginSession
 
beginSession
Start a new session. Web services use a connectionless protocol. This operation allows multiple Web service invocations to appear as if they belong to the same session.
This operation places a cookie on the HTTP connection. If the client supports cookies, no additional actions are required to maintain the session.
As a second option, the client can provide the returned session token in the HTTP basic authentication using &sessionToken=X for the user name and providing a blank password, where X is the session token returned by this operation.
As a third option, the client can provide the returned session token with a SOAP header element sessionToken like the following:
  <soap-env:Envelope
    xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:security="http://www.compositesw.com/services/system/util/security">
    <soap:Header>
      <security:sessionToken>b9f5d033fb4a81-b02b5b760641c1d6</security:sessionToken>
    </soap:Header>
    <soap-env:Body>
      <!-- write body element -->
    </soap-env:Body>
  </soap-env:Envelope>
 
If the token is received by the server through more than one of these approaches, precedence is first given to the SOAP header, then to the HTTP authentication, and lastly to the cookie.
While the session is open, all responses for requests made during the session contain a “PUT_SOMETHING_HERE” session token in the SOAP header element.
Location
/services/webservices/system/util/session/operations/
Request Elements
sessionTimeout (optional): The number of seconds to keep an inactive session alive before it is automatically closed.
To view the default session timeout, select Administration > Configuration from the Studio menu bar and check the value of the Session Timeout parameter under ...> Sessions.
sessionName (optional): The session name. This usually includes the application name as part of the string.
Request Example
<session:beginSession xmlns:session="http://www.compositesw.com/services/system/util/session">
<session:sessionTimeout>1200</session:sessionTimeout>
<session:sessionName>backup-restore-monthly</session:sessionName>
</session:beginSession>
Response Elements
sessionToken: A token that uniquely identifies this session. This should be used within the SessionToken SOAP header for future invocations of operations.
Faults
IllegalArgument: If sessionTimeout is present and is not a positive integer.
NotAllowed: If a session for the current connection is already open.