Connecting to Your Account

When connecting to the server you must first provide your account username and password. These
are the same details you use when logging into the website. You must keep the credential object for
use in later requests - you will see it is a parameter that you will need to pass in subsequent requests.

The call to the authorisation method will return a credentials object which will either be populated with your account details or it will have a default unauthorised account number of -99.

You may wish to throw your own exception of unauthorised access if the returned object contains a customer id of -99. We have just shown a comment of //Authentication Failed

C#

// connect to server
WorkMobileIntegration service = new WorkMobileIntegration();

// authenticate
WMCrendential credentials = service.WMAuthorisation("joe.bloggs@esayltd.co.uk", "jb$1259");

// check
if (credentials.CustomerId == -99)
{
    // authentication failed
}

Java

// connect to server
URL url = new URL("https://www.esayworkmobile.co.uk/wmbapi3/workmobileintegration.asmx");
QName serviceName = new QName("https://www.esayworkmobile.co.uk/", "WorkMobileIntegration");
WorkMobileIntegration integration = new WorkMobileIntegration(url, serviceName);
service = integration.getWorkMobileIntegrationSoap();

// authenticate
WMCrendential credentials = service.wmAuthorisation("joe.bloggs@esayltd.co.uk", "jb$1259");

// check
if (credentials.getCustomerId() == -99) {
    // authentication failed
}