Manipulating Mobile Users and Simple Entities
Retrieving Mobile Users
The process for retrieving mobile users, job types, jobs, and most other types is essentially the same. Pass a new instance of the Business Object class for which you want data (for example, BOMobileUser, BOJob, BOJobType, etc.) to the retrieve methods as detailed below.
The BOMobileUser object (and the full set of WorkMobile entities) are generated by adding the service reference in Visual Studio or using the Java wsimport tool.
C#
object[] userList = service.RetrieveAll(new BOMobileUser(), credentials);
Java
List list = service.retrieveAll(new BOMobileUser(), credentials).getAnyType();
Retrieving a specific Mobile User
Single objects can be retrieved by ID (MobileUserId, JobId, JobTypeId, etc.).
These follow the pattern of instantiating an object of the correct type, setting the ID value of the entity and then calling the service.RetrieveById method.
C#
BOMobileUser mobileUser = new BOMobileUser();
mobileUser.MobileUserId = REQUIRED_ID;
mobileUser = service.RetrieveById(mobileUser, credentials);
Java
BOMobileUser mobileUser = new BOMobileUser();
mobileUser.setMobileUserId(REQUIRED_ID);
mobileUser = service.retrieveById(mobileUser, credentials);
Creating a Mobile User and other types of entities
To create a mobile user or other entity such as a job type etc - the process is straightforward.
Instantiate the class of object you wish to create, populate the properties on the object and call the service.Add method.
You can discover the properties available on each class by using the intellisense features of your development tools, or by navigating the webservice url and adding the ?WSDL parameter to get the full technical service description.
https://www.esayworkmobile.co.uk/wmbapi36/workmobileintegration.asmx?WSDL
Showing the section that defines the properties on the BOJobType object, a full list of entities and their properties is discoverable at this URL
<s:complexType name="BOJobType">
<s:complexContent mixed="false">
<s:extension base="tns:BOBaseDataObject">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="JobTypeFields" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="AdditionalSummaryFields" type="tns:ArrayOfAnyType"/>
</s:sequence>
<s:attribute name="XSDSchema" type="s:string"/>
<s:attribute name="JobTypeId" type="s:int" use="required"/>
<s:attribute name="Name" type="s:string"/>
<s:attribute name="Description" type="s:string"/>
<s:attribute name="Live" type="s:boolean" use="required"/>
<s:attribute name="OnRouteStatus" type="s:boolean" use="required"/>
<s:attribute name="UserFormId" type="s:int" use="required"/>
<s:attribute name="SummaryField1" type="s:string"/>
<s:attribute name="SummaryField2" type="s:string"/>
<s:attribute name="SummaryField3" type="s:string"/>
</s:extension>
</s:complexContent>
</s:complexType>
To add a new mobile user via the API is as follows
C#
BOMobileUser mobileUser = new BOMobileUser();
mobileUser.Username = "someuser";
// Password is only setable
mobileUser.Password = "somesecret";
mobileUser.Firstname = "Bob";
mobileUser.Surname = "Someuser";
mobileUser.AddressLine1 = "Someplace";
// add object to server
int mobileUserId = service.Add(mobileUser, credentials);
// Instantiate object
BOMobileUser mobileUser = new BOMobileUser();
mobileUser.setUsername("someuser");
mobileUser.setPassword("somesecret");
mobileUser.setFirstname("Bob");
mobileUser.setSurname("Someuser");
mobileUser.setAddressLine1("Someplace");
// add object to server
int mobileUserId = service.add(mobileUser, credentials);
Single objects can be retrieved by ID (MobileUserId, JobId, JobTypeId, etc.).
These follow the pattern of instantiating an object of the correct type, setting the ID value of the entity and then calling the service.retrieve method.