SessionID vs Access key
Whenever you want to set up a session using web services, a proper identification needs to be established.
This can either be done via creating a sessionID or via an
access key.
This article describes how to do that for both ways of authentication.
sessionID
When using a sessionID, you need to start by calling the following two endpoints:
• ../nyx/services/PlanonSession.PlanonSessionHttpsSoap11Endpoint/
• ../nyx/services/PlanonSession.PlanonSessionHttpsSoap12Endpoint/
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:per="http://Person.ws">
<soap:Header/>
<soap:Body>
<per:login>
<!--Optional:-->
<per:args0>[USERNAME]</per:args0>
<!--Optional:-->
<per:args1>[PASSWORD]</per:args1>
</per:login>
</soap:Body>
</soap:Envelope>
This will return:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header/>
<soapenv:Body>
<ns:loginResponse xmlns:ns="http://Person.ws">
<ns:return>[SESSIONID]</ns:return>
</ns:loginResponse>
</soapenv:Body>
</soapenv:Envelope>
Once you have retrieved the sessionID you can add that to the actual request, in this case the Read-BOM on the Person business object:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:per="http://person.Person.ws">
<soap:Header/>
<soap:Body>
<per:read>
<!--Optional:-->
<per:args0>[SESSIONID]</per:args0>
<per:args1>[SYSCODE]</per:args1>
</per:read>
</soap:Body>
</soap:Envelope>
| When using the sessionID, all requests are performed in the same session. When done, the session should be properly closed. |
Closing session
When using the sessionID, it is good practice to close the session by using the following request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:per="http://Person.ws">
<soap:Header/>
<soap:Body>
<per:logout>
<!--Optional:-->
<per:args0>[SESSIONID]</per:args0>
</per:logout>
</soap:Body>
</soap:Envelope>
Access key
If you want to use use an access key, simply replace the sessionID in the earlier request with the access key.
| When using an access key, unlike with sessionID, a session is used per request - it is automatically opened and closed. |