Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The first step when using the MyAlerts web service is to create a client session key. The CreateSessionKey method must be called to retrieve the ClientId and SessionKey which are required in all calls to the MyAlerts Web Services. This function is automatically called by the iShare portal.

CreateSessionKey

Input Parameters

The CreateSessionKey method needs the following parameters:

CreateSessionKey Input parameters

Username

This is the client user name as registered with Astun Technology Ltd.

Password

This is the password for the client user name.

Key

This is the unique key supplied by Astun Technology Ltd when you register.

Returned Parameters

The following parameters will be returned:

Syntax
<CreateSessionKeyResult>
        <Error>
          <Code>string</Code>
          <Description>string</Description>
        </Error>
        <Success>boolean</Success>
        <ClientId>int</ClientId>
        <SessionKey>string</SessionKey>
</CreateSessionKeyResult>

Error - Code / Description

An error code and description if the call to the web service is unsuccessful and the Success if False.

1019 – Error creating Session key

1024 – Client authentication failed

Success

This will be either True or False. If False an error message will be provided in the Error result, if True the ClientId and SessionKey will be provided.

ClientId

This is the unique id for the client and is used in subsequent web service calls

SessionKey

This is a unique session key for the client.

Code Examples

c#

Add a web reference to the users.asmx web service using the Visual Studio IDE.

Add the code below to retrieve the Client Id and the Session Key:

C# Example
Users.Users uws = new Users.Users();
 
//Use UserName, Password and Key as defined in your data.xml file
Users.SessionKeyResult result = uws.CreateSessionKey("[UserName]", "[Password]", "[Key]");
            
if (result.Success)
{
	Response.Write("Client Id: " + result.ClientId + "<br/>");
    Response.Write("Session Key: " + result.SessionKey + "<br/>");
}
else
    Response.Write("Failed to create the session key");
 

Python

In the code below, use your own path to web service and UserName, Password and Key defined in your data.xml file

Python Example
import suds
url = "http://[PATH TO WEBSERVICE]/users.asmx?wsdl"
client = suds.client.Client(url)
result = client.service.CreateSessionKey("[UserName]", "[Password]", "[Key]")
if result.Success:
  print "ClientId: %s" % result.ClientId
  print "Session Key: %s" % result.SessionKey
else:
  print "Could not get session key"
  • No labels