0% found this document useful (0 votes)
248 views241 pages

AirWatch SOAP API Guide v9 - 1

AirWatch SOAP API Guide v9_1

Uploaded by

Domenico Rafti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
248 views241 pages

AirWatch SOAP API Guide v9 - 1

AirWatch SOAP API Guide v9_1

Uploaded by

Domenico Rafti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 241

VMware AirWatch SOAP API Guide

Configuring and using the SOAP API

AirWatch v8.4 and above

Have documentation feedback? Submit a Documentation Feedback support ticket using the Support Wizard on
support.air-watch.com.
Copyright © 2017 VMware, Inc. All rights reserved. This product is protected by copyright and intellectual property laws in the United States and other countries as well as by
international treaties. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents.
VMware is a registered trademark or trademark of VMware, Inc. in the United States and other jurisdictions. All other marks and names mentioned herein may be trademarks of their
respective companies.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

1
Revision Table
The following table displays revisions to this guide since the release of AirWatch v8.4 and above.
Date Reason
April 2017 Initial upload. Document posted for AirWatch v9.1 GA.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

2
Table of Contents
Chapter 1: Overview 6
Introduction 7
Important API Considerations 7
Creating a Request 8

Chapter 2: Device Data Service 12


LoadDeviceGpsDataForDateRange(TimePeriod) 13
LoadDeviceApplicationList 17
LoadProvisioningProfiles 21
LoadConfigurationProfiles 25
LoadDeviceMetricDetails 30
LoadAdaptersByDevice 35
ListCertificates 41
GetSecurityAuditDetails 45

Chapter 3: Device Profile Services 51


InstallDeviceProfile 52
RemoveDeviceProfile 55
CopyProfileToLocationGroup 58
GetDeviceProfileByID 60

Chapter 4: Device Service 62


Save 63
Load 67
Search 69
UpdateDevice 74
Device Commands 77
QueryDevice 99
RemoveDevice 103
GetDevicesByIsCompromised 106
GetDeviceSummaryByPasscode 106
GetDeviceSummaryByDataEncryption 107

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

3
GetDeviceSummaryByOwnership 107
GetDeviceSummaryByPlatform 107

Chapter 5: Enrollment Service 108


Overview 109
RegisterEnrollmentUser 109
RegisterDeviceForUser 111
RemoveEnrollmentUser 116
PublishUserProfiles 121
LoadEnrolledDeviceUser 125

Chapter 6: Location Group Service 129


Load 130
Save 134
139
Search 140
DeleteLocationGroup 144
DeleteUserInGroup 148
ProvisionLocationGroup 151
LoadGroupAuthenticationTypes 155
GetEnrollmentStatusForLg 158
161
LoadHierarchy 162

Chapter 7: Location Services 166


Load 167
Save 170
Search 176
List 180

Chapter 8: Pick List Service 184


Overview 185
LoadLocationGroupTypeList 185
LoadLocationTypeList 189

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

4
LoadLocationStatusList 192
LoadAddressTypeList 194
LoadCountryList 197
LoadDeviceCategoryList 200
LoadOwnershipList 202

Chapter 9: User Service 205


Load 206
Save 210
Search 212
List 216
AddUserToRole 218
CreateAdminUser 223
DeleteAdminUser 226
GetUsersInGroup 229
ResetAdminUser 234

Chapter 10: Tables A: Catalog of Services 237

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

5
Chapter 1:
Overview
Introduction 7
Important API Considerations 7
Creating a Request 8

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

6
Chapter 1: Overview

Introduction
AirWatch Web Services is a collection of interfaces that allow external programs to invoke the core product functionality.
This can be used to integrate with existing IT infrastructure and third party applications.
This guide is targeted at developers who are building applications that uses these services for providing device
management capabilities. It describes the available Application Programming Interfaces (API) and potential integration
challenges.
Use of this guide assumes familiarity with the following:
l A basic understanding of web services.

l A programming language for consuming a web service and any related tools.

Note: The API references in this document align with the AirWatch Services offerings in AirWatch version 6.5.

Important API Considerations


Convention Description
Inline code samples are identified with a fixed width font.
Code in Text
Example: Invoke the API RegisterDeviceForUser
Code blocks are identified with a fixed width font, a border and a distinct fill color.
Code Blocks

Emphasis Emphasized content is presented in italics.


Object Structures are graphically represented as a tree. Bold text indicates a mandatory attribute.

Data Object

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

7
Chapter 1: Overview

Creating a Request
Making a request involves creating a request proxy for the correct endpoint and initializing authentication credentials.
AirWatch Web Services use client certificate authentication. Clients must present a valid and recognized certificate as a
part of the SSL handshake.
For a .net client, this information goes into the application configuration file.

Sample Client App.Config

<?xml version="1.0" encoding="utf-8" ?>


<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<Binding
name="ClientPeerToPeerCertificateSecuredBindinging"maxReceived
MessageSize="50000000">
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ClientPeerToPeerCertificateSecuredBehavior">
<clientCredentials>
<!--- Mapping AW API Client Root Certificate -->
<clientCertificate findValue="999e5d9db84141b69ea5bdf5e8d0c02-8db56d5a6"
x509FindType="FindByThumbprint"
storeLocation="LocalMachine"
storeName="My"/>
<serviceCertificate>
<authentication certificateValidationMode="PeerTrust"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://host/AirWatchServices/PicklistService-
Endpoint.svc"
behaviorConfiguration="ClientPeerToPeerCertificateSecuredBehavior"
binding="wsHttpBinding"
bindingConfiguration="ClientPeerToPeerCertificateSecuredBindinging"
contract="PicklistService.IPicklistService"
name="PicklistServiceEndPoint">
<identity>

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

8
Chapter 1: Overview

<dns value="AW API Server" />


</identity>
</endpoint>
<endpoint address="http://host/AirWatchServices/UserServiceEndpoint.svc"
behaviorConfiguration="ClientPeerToPeerCertificateSecuredBehavior"m
binding="wsHttpBinding"
bindingConfiguration="ClientPeerToPeerCertificateSecuredBindinging"
contract="UserService.IUserService" name="UserServiceEndPoint">
<identity>
<dns value="AW API Server" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

9
Chapter 1: Overview

Java Sample Code

import javax.net.ssl.SSLContext;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.log4j.BasicConfigurator;
import services.com.air_watch.www.EnrollmentServiceEndpointStub;
import org.apache.commons.httpclient.protocol.Protocol;
import org.jsslutils.sslcontext.X509SSLContextFactory;
// End Point
EndpointReference targetEndPoint = new EndpointReference (endPointURI);
// Key store
KeyStore keyStore = KeyStore.getInstance("JKS");
InputStream keyInput = new FileInputStream(testProps.getProperty
("javax.net.ssl.keyStore"));
keyStore.load(keyInput, "XX-PASSWORD".toCharArray());
keyInput.close();
// Trust Store
KeyStore trustStore = KeyStore.getInstance("JKS");
keyInput = new FileInputStream(testProps.getProperty
("javax.net.ssl.trustStore"));
trustStore.load(keyInput, "XX-PASSWORD".toCharArray());
keyInput.close();
// SSL Context
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(keyStore,
" XX-PASSWORD", trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
// Request Proxy
PicklistServiceEndpointStub stub = new
PicklistServiceEndpointStub();
stub._getServiceClient().engageModule("addressing");
// Create the request. Disable Chunked Transfer stub._getServiceClient
().getOptions().setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
stub._getServiceClient().getOptions().setProperty(
org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
PicklistServiceEndpointStub.LoadOwnershipList ownershipList =
new PicklistServiceEndpointStub.LoadOwnershipList();
try
{
PicklistServiceEndpointStub.LoadOwnershipListResponse response
=
stub.loadOwnershipList(ownershipList);
PicklistServiceEndpointStub.ArrayOfOwnershipListItem owners =
response.getLoadOwnershipListResult();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

10
Chapter 1: Overview

PicklistServiceEndpointStub.OwnershipListItem[] listItems =
owners.getOwnershipListItem();
// Add Business Logic
}
catch (Exception ex) { Logger.getLogger
TestClient.class.getName()).log(Level.SEVERE, null, ex);
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

11
Chapter 2:
Device Data Service
LoadDeviceGpsDataForDateRange(TimePeriod) 13
LoadDeviceApplicationList 17
LoadProvisioningProfiles 21
LoadConfigurationProfiles 25
LoadDeviceMetricDetails 30
LoadAdaptersByDevice 35
ListCertificates 41
GetSecurityAuditDetails 45

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

12
Chapter 2: Device Data Service

LoadDeviceGpsDataForDateRange(TimePeriod)
The method signatures are identical for these two methods, both returns a list of GPS coordinates. They differ in the
specification of the search criteria. For LoadDeviceGpsDataForDateRange, specify the StartDate and EndDate. For
LoadDeviceGpsDataForTimePeriod, specify the number of days as the Time Period.
General constraints/validations considered in the above methods:
l Maximum number of days/period considered for getting the GPS data is 180 days. In case of date-range API, if the
difference between the start-date and end-date is more than 180 days then a period of 180 days is considered from
the end date.

l The number of GPS points returned will be MAXPOINTS + 1, if the number of points present exceeds the
MAXPOINTS. This is because the business logic always adds the end point to the list.

Request Parameters:

Response Elements:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

13
Chapter 2: Device Data Service

C# Sample Code for LoadDeviceGpsDataForDateRange (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceData.DeviceDataService;

namespace DeviceData
{
{
class DeviceGpsDataForDate
{
static void Main(string[] args)
{
try
{
// Create an instance of DeviceDataServiceClient
DeviceDataServiceClient client = new DeviceDataServiceClient
();

// Device ID to query the GPS Logs


EntityKey deviceId = new EntityKey { Value = 208 };
DeviceGpsDataSearchCriteria deviceGPSSearch = new
DeviceGpsDataSearchCriteria();
deviceGPSSearch.StartDate = Convert.ToDateTime("01-01-2010");
deviceGPSSearch.EndDate = Convert.ToDateTime("01-07-2011");
deviceGPSSearch.MaxPoints = 2;

/* An instance of AWOperationContext holds the current user


context.For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };

GPSCoordinateEntity[] deviceResult =
client.LoadDeviceGpsDataForDateRange(deviceId,
deviceGPSSearch, operationContext);
if (deviceResult != null)
{
Console.WriteLine("GPS data is successfully loaded for the
device. Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("GPS data load failed. Please try again.
Press any key to continue..");Console.ReadLine();
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

14
Chapter 2: Device Data Service

}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

C# Sample Code for LoadDeviceGpsDataForTimePeriod (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceData.DeviceDataService;

namespace DeviceData
{

class LoadGPSDataByTime
{
static void Main(string[] args)
{
try
{
// Create an instance of DeviceDataServiceClient
DeviceDataServiceClient client = new DeviceDataServiceClient
();

// Device ID to query the GPS Logs


EntityKey deviceId = new EntityKey { Value = 208 };
DeviceGpsDataSearchCriteria deviceGpsSearch = new
DeviceGpsDataSearchCriteria();
deviceGpsSearch.MaxPoints = 2;
deviceGpsSearch.TimePeriod = 140;

/* An instance of AWOperationContext holds the current user


context.For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };
GPSCoordinateEntity[] deviceResult =
client.LoadDeviceGpsDataForTimePeriod(deviceId,
deviceGpsSearch, operationContext);
if (deviceResult != null)
{

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

15
Chapter 2: Device Data Service

Console.WriteLine("GPS data is successfully loaded for the


device. Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("GPS data load failed. Please try again.
Press any key to continue..");
Console.ReadLine();
}
}

catch (Exception ex)


{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code

private void loadGPSDataForDateRange(DeviceDataServiceEndpointStub stub)


{
DeviceDataServiceEndpointStub.LoadDeviceGpsDataForDateRange request = new
DeviceDataServiceEndpointStub.LoadDeviceGpsDataForDateRange();

// Operation Context
DeviceDataServiceEndpointStub.ServiceIdentity serviceIdentity
= new DeviceDataServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("[email protected]");

DeviceDataServiceEndpointStub.AWOperationContext operationContext = new


DeviceDataServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);

// Device
DeviceDataServiceEndpointStub.EntityKey device
= new DeviceDataServiceEndpointStub.EntityKey();
device.setValue(208);

DeviceDataServiceEndpointStub.DeviceGpsDataSearchCriteria searchCriteria
= new DeviceDataServiceEndpointStub.DeviceGpsDataSearchCriteria();

// Date range
Calendar startDate = Calendar.getInstance();
startDate.add(Calendar.DAY_OF_MONTH, -5);
searchCriteria.setStartDate(startDate);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

16
Chapter 2: Device Data Service

searchCriteria.setEndDate(Calendar.getInstance());

request.setDeviceId(device);
request.setDeviceGpsDataSearchTransport(searchCriteria);

DeviceDataServiceEndpointStub.LoadDeviceGpsDataForDateRangeResponse
response = stub.loadDeviceGpsDataForDateRange(request);
DeviceDataServiceEndpointStub.ArrayOfGPSCoordinateEntity gpsList =
response.getLoadDeviceGpsDataForDateRangeResult();

DeviceDataServiceEndpointStub.GPSCoordinateEntity[] coordinateList =
gpsList.getGPSCoordinateEntity();
}

LoadDeviceApplicationList
This API returns the list of applications for a device and takes DeviceEntity as input with the device-ID in it.

Request Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

17
Chapter 2: Device Data Service

Response Parameters:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceData.DeviceDataService;
namespace DeviceData
{

class DeviceApplicationList
{

static void Main(string[] args)


{

try
{
//Create an instance of DeviceDataServiceClient
DeviceDataServiceClient client = new DeviceDataServiceClient();

// DeviceEntity containing Device ID


const int deviceId = 2561;
var deviceEntity = new DeviceEntity();
deviceEntity.Id = new EntityKey { Value = deviceId };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
var operationContext = new AWOperationContext();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

18
Chapter 2: Device Data Service

operationContext.Identity = new ServiceIdentity() { Name =


userName };

ApplicationOverviewTransport[] applicationOverviewTransport =
client.LoadDeviceApplicationList(deviceEntity, operationContext);
if (applicationOverviewTransport != null)
{
Console.WriteLine("Application list is successfully loaded for
the device. Press any key to continue..");
Console.ReadLine();
else
{
Console.WriteLine("Application list load failed. Please try
again. Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code

public void loadDeviceApplicationList() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceDataService
Endpoint.svc"; System.setProperty
("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();
String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

19
Chapter 2: Device Data Service

String trustStorePassword = "changeit";


trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory
(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https",new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
DeviceDataServiceEndpointStub stub = newDeviceDataServiceEndpointStub();
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceDataServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceDataServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
DeviceDataServiceEndpointStub.AWOperationContext operationContext =
new DeviceDataServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);
DeviceDataServiceEndpointStub.EntityKey entityKey=new
DeviceDataServiceEndpointStub.EntityKey();
entityKey.setValue(2561); DeviceDataServiceEndpointStub.DeviceEntity
deviceEntity=new
DeviceDataServiceEndpointStub.DeviceEntity();
deviceEntity.setId(entityKey);
DeviceDataServiceEndpointStub.LoadDeviceApplicationList
loadDeviceApplicationList=new
DeviceDataServiceEndpointStub.LoadDeviceApplicationList();
loadDeviceApplicationList.setDeviceEntity(deviceEntity);
loadDeviceApplicationList.setOperationContext(operationContext);
DeviceDataServiceEndpointStub.LoadDeviceApplicationListResponse
loadDeviceApplicationListResponse=stub.loadDeviceApplicationList
(loadDeviceApplicationList);
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

20
Chapter 2: Device Data Service

LoadProvisioningProfiles
This API returns the provisioning profiles for a device and takes DeviceEntity as input with the device-ID in it.

Request Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

21
Chapter 2: Device Data Service

Response Parameters:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq; using System.Text;
using DeviceData.DeviceDataService;

namespace DeviceData
{
class ProvisionProfiles { static void Main(string[] args)
{
try
{
//Create an instance of DeviceDataServiceClient
DeviceDataServiceClient client = new DeviceDataServiceClient();
//DeviceEntity containing Device ID
const int deviceId = 2561;
var deviceEntity = new DeviceEntity();
deviceEntity.Id = new EntityKey { Value = deviceId };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };
ProvisioningProfileSummary provisioningProfileSummary =
client.LoadProvisioningProfiles(deviceEntity, operationContext);
if (provisioningProfileSummary != null)
{

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

22
Chapter 2: Device Data Service

Console.WriteLine("Provisioning Profile Summary is successfully


loaded for the device. Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Provisioning Profile Summary load failed.
Please try again. Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code(Console Application)

public void loadProvisioningProfiles() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceDataService
Endpoint.svc";
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");


String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray()); keyInput.close
();
String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");
keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close(); X509SSLContextFactory sslContextFactory = new
X509SSLContextFactory( keyStore, keyStrorePassword.toCharArray(),
trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

23
Chapter 2: Device Data Service

DeviceDataServiceEndpointStub stub = new DeviceDataServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try
{
DeviceDataServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceDataServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

DeviceDataServiceEndpointStub.AWOperationContext operationContext =
new DeviceDataServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

DeviceDataServiceEndpointStub.EntityKey entityKey=new
DeviceDataServiceEndpointStub.EntityKey();

entityKey.setValue(572);

DeviceDataServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceDataServiceEndpointStub.DeviceEntity();
deviceEntity.setId(entityKey);
DeviceDataServiceEndpointStub.LoadProvisioningProfiles
loadProvisioningProfiles=new
DeviceDataServiceEndpointStub.LoadProvisioningProfiles();
loadProvisioningProfiles.setDeviceEntityTransport(deviceEntity);
loadProvisioningProfiles.setOperationContext(operationContext);
DeviceDataServiceEndpointStub.LoadProvisioningProfilesResponse
loadProvisioningProfilesResponse=stub.loadProvisioningProfiles
(loadProvisioningProfiles);
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

24
Chapter 2: Device Data Service

LoadConfigurationProfiles
This API returns the configuration profiles for a device. It also takes deviceEntity as input with the device-ID in it and
returns the Configuration Profile summary for that device.

Request Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

25
Chapter 2: Device Data Service

Response Parameters:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceData.DeviceDataService;
namespace DeviceData
{
class ConfigurationProfiles
{
static void Main(string[] args)
{
try
{
// Create an instance of DeviceDataServiceClient
DeviceDataServiceClient client = new DeviceDataServiceClient
();

// DeviceEntity containing Device ID


const int deviceId = 2561;
var deviceEntity = new DeviceEntity();
deviceEntity.Id = new EntityKey { Value = deviceId };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

const string userName = "Administrator";


var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

26
Chapter 2: Device Data Service

DeviceConfigurationProfileSamples configuratioProfileSamples =
client.LoadConfigurationProfiles(deviceEntity,
operationContext);

if (configuratioProfileSamples != null)
{
Console.WriteLine("Configuration Profile Samples are
successfully loaded for the device. Press any key to
continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Configuration Profile Samples failed to
load. Please try again. Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code

public void loadConfigurationProfiles() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceDataService
Endpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

27
Chapter 2: Device Data Service

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();


Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceDataServiceEndpointStub stub = new DeviceDataServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_
HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try
{
DeviceDataServiceEndpointStub.ServiceIdentity serviceIdentity =
new DeviceDataServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
DeviceDataServiceEndpointStub.AWOperationContext operationContext =
new DeviceDataServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

DeviceDataServiceEndpointStub.EntityKey entityKey=new
DeviceDataServiceEndpointStub.EntityKey();
entityKey.setValue(572);
DeviceDataServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceDataServiceEndpointStub.DeviceEntity();

deviceEntity.setId(entityKey);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

28
Chapter 2: Device Data Service

DeviceDataServiceEndpointStub.LoadConfigurationProfiles
loadConfigurationProfiles=new
DeviceDataServiceEndpointStub.LoadConfigurationProfiles();

loadConfigurationProfiles.setDeviceEntityTransport(deviceEntity);

loadConfigurationProfiles.setOperationContextTransport
(operationContext);

DeviceDataServiceEndpointStub.LoadConfigurationProfilesResponse
loadConfigurationProfilesResponse=stub.loadConfigurationProfiles

(loadConfigurationProfiles);

} catch (Exception ex) {

Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);


}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

29
Chapter 2: Device Data Service

LoadDeviceMetricDetails
This API returns the type DeviceMectricEntity with the information about the device. The input to this is DeviceEntity
with the value of ID.

Request Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

30
Chapter 2: Device Data Service

Response Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

31
Chapter 2: Device Data Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceData.DeviceDataService;

namespace DeviceData
{
class DeviceMetric
{
static void Main(string[] args)
{
try
{

// Create an instance of DeviceDataServiceClient


DeviceDataServiceClient client = new DeviceDataServiceClient
();

// DeviceEntity containing Device ID


const int deviceId = 2561;
var deviceEntity = new DeviceEntity();
deviceEntity.Id = new EntityKey { Value = deviceId };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };
var result = client.LoadDeviceMetricDetails(deviceEntity,
operationContext);
if (result != null)
{
Console.WriteLine("Device Metric Details are successfully
loaded for the device. Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Device Metric Details failed to load.
Please try again. Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

32
Chapter 2: Device Data Service

}
}
}

Java Sample Code

public void LoadDeviceMetricDetails() throws AxisFault, Exception {


String endPointURI =
"https://host.AirWatchportals.com/AWBasicHttpService/DeviceDataServiceEnd
point.svc";
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");
String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());

keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks"; KeyStore trustStore
= KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(


keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext,false), 443);
DeviceDataServiceEndpointStub stub = new DeviceDataServiceEndpointStub();
stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

33
Chapter 2: Device Data Service

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
DeviceDataServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceDataServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

DeviceDataServiceEndpointStub.AWOperationContext operationContext = new


DeviceDataServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);
DeviceDataServiceEndpointStub.EntityKey entityKey=new
DeviceDataServiceEndpointStub.EntityKey();

entityKey.setValue(572);

DeviceDataServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceDataServiceEndpointStub.DeviceEntity();

deviceEntity.setId(entityKey);

DeviceDataServiceEndpointStub.LoadDeviceMetricDetails
loadDeviceMetricDetails=new
DeviceDataServiceEndpointStub.LoadDeviceMetricDetails();

loadDeviceMetricDetails.setDeviceEntity(deviceEntity);
loadDeviceMetricDetails.setOperationContext(operationContext);

DeviceDataServiceEndpointStub.LoadDeviceMetricDetailsResponse
loadDeviceMetricDetailsResponse=stub.loadDeviceMetricDetails
(loadDeviceMetricDetails);
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

34
Chapter 2: Device Data Service

LoadAdaptersByDevice
This API is intended to give network status related to the particular device. It returns an array of AdapterEntityTransport[]
which contains all the details of the network status. Depending upon the network status, it will contain the objects of
following type. (These are the derived class of AdapterEntityTransport class):
l WWANAdapterEntityTransport

l WLANAdapterEntityTransport

l BluetoothAdapterEntityTransport

l OtherAdapterEntityTransport

l ActiveSyncAdapterEntityTransport
(Find the Response Elements: diagrams for the class structure)

Request Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

35
Chapter 2: Device Data Service

Response Parameters:

Note:
1. CellularTechnologyTransport is an enum and it indicates whether the device uses GSM, CDMA, and None. If the
information is NULL in database then its value is UnKnown.
2. If particular network is not found for that device, then a corresponding object will not there in the result array.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

36
Chapter 2: Device Data Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceData.DeviceDataService;

namespace DeviceData
{
class Adapters
{
static void Main(string[] args)
{
try
{
//Create an instance of DeviceDataServiceClient

DeviceDataServiceClient client = new DeviceDataServiceClient


();

//DeviceEntity containing Device ID


const int deviceId = 2561;
var deviceEntity = new DeviceEntity();
deviceEntity.Id = new EntityKey { Value = deviceId };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };
var result = client.LoadAdaptersByDevice(deviceEntity,
operationContext);
if (result != null)
{
Console.WriteLine("Adapters are successfully loaded for the
device. Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Adaptersfailedtoload.Pleasetryagain.Pressanykeyto
continue..");
Console.ReadLine();
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

37
Chapter 2: Device Data Service

catch(Exceptionex)
{
Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

38
Chapter 2: Device Data Service

Java Sample Code

//
public void loadDeviceApplicationList() throws AxisFault, Exception {
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceDataServiceEndp
oint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks"; KeyStore trustStore
= KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";


trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(


keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
DeviceDataServiceEndpointStub stub = new DeviceDataServiceEndpointStub();
stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_
HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

39
Chapter 2: Device Data Service

DeviceDataServiceEndpointStub.ServiceIdentity serviceIdentity = new


DeviceDataServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
DeviceDataServiceEndpointStub.AWOperationContext operationContext = new
DeviceDataServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);
DeviceDataServiceEndpointStub.EntityKey entityKey=new
DeviceDataServiceEndpointStub.EntityKey();

entityKey.setValue(2561);
DeviceDataServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceDataServiceEndpointStub.DeviceEntity();
deviceEntity.setId(entityKey);

DeviceDataServiceEndpointStub.LoadDeviceApplicationList
loadDeviceApplicationList=new
DeviceDataServiceEndpointStub.LoadDeviceApplicationList();

loadDeviceApplicationList.setDeviceEntity(deviceEntity);

loadDeviceApplicationList.setOperationContext(operationContext);

DeviceDataServiceEndpointStub.LoadDeviceApplicationListResponse
loadDeviceApplicationListResponse=stub.loadDeviceApplicationList
(loadDeviceApplicationList);

} catch (Exception ex) {


Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

40
Chapter 2: Device Data Service

ListCertificates
This API lists all the certificate details associated with the device. It returns an object of
DeviceCertificateSamplesViewTransport, which contains the list of certificate information.

Request Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

41
Chapter 2: Device Data Service

Response Parameters:

Note: The certificate’s raw data is returned in the form of byte [] Data. Using this Data, certificate can be created.

// C# code to create certificate using byte[]:


X509Certificate2 _X509Certificate = new X509Certificate2(byteArrayData)

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

42
Chapter 2: Device Data Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceData.DeviceDataService;

namespace DeviceData
{
class Certificates
{
static void Main(string[] args)
{

try
{

// Create an instance of DeviceDataServiceClient


DeviceDataServiceClient client = new DeviceDataServiceClient();

// DeviceEntity containing Device ID


const int deviceId = 100;
var deviceEntity = new DeviceEntity();
deviceEntity.Id = new EntityKey { Value = deviceId };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };
var result = client.ListCertificates(deviceEntity,
operationContext);
if (result != null)
{
Console.WriteLine("Certificates are successfully loaded for the
device. Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Certificates failed to load. Please try again.
Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

43
Chapter 2: Device Data Service

}
}
}

Java Sample Code

public void listCertificates() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceDataServiceEndp
oint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());

keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext,false), 443);

DeviceDataServiceEndpointStub stub = new DeviceDataServiceEndpointStub();

stub._getServiceClient()

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

44
Chapter 2: Device Data Service

.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_
HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceDataServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceDataServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
DeviceDataServiceEndpointStub.AWOperationContext operationContext = new
DeviceDataServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);

DeviceDataServiceEndpointStub.EntityKey entityKey=new
DeviceDataServiceEndpointStub.EntityKey();
entityKey.setValue(572);
DeviceDataServiceEndpointStub.DeviceEntity deviceEntity=new

DeviceDataServiceEndpointStub.DeviceEntity();
deviceEntity.setId(entityKey);

DeviceDataServiceEndpointStub.ListCertificates listCertificates=new
DeviceDataServiceEndpointStub.ListCertificates();

listCertificates.setDeviceEntity(deviceEntity);

listCertificates.setOperationContext(operationContext);

DeviceDataServiceEndpointStub.ListCertificatesResponse
listCertificatesResponse=stub.listCertificates(listCertificates);

} catch (Exception ex) {


Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

GetSecurityAuditDetails
This API returns the Security Audit information.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

45
Chapter 2: Device Data Service

Request Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

46
Chapter 2: Device Data Service

Response Parameters:
Find the response element structure in the below image:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceData.DeviceDataService;
namespace DeviceData
{
class ComplianceSummary
{
static void Main(string[] args)
{

try
{
// Create an instance of DeviceDataServiceClient
DeviceDataServiceClient client = new DeviceDataServiceClient
();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

47
Chapter 2: Device Data Service

// DeviceEntity containing Device ID


const int deviceId = 2561;
var deviceEntity = new DeviceEntity();
deviceEntity.Id = new EntityKey { Value = deviceId };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

const string userName = "Administrator";


var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };
var result = client.GetSecurityAuditDetails(deviceEntity,
operationContext);
if (result != null)
{
Console.WriteLine("Security Audit Details are successfully
loaded for the device. Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Security Audit Details failed to load.
Please try again. Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Note:
l LastSIMCardChange30:
o True indicates - SIM card change detected

o True indicates - SIM card change detected

o True indicates - SIM card change detected

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

48
Chapter 2: Device Data Service

Java Sample Code

public void getSecurityAuditDetails() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceDataServiceEndp
oint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);


KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());

keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks"; KeyStore trustStore
= KeyStore.getInstance("JKS");
keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(


keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceDataServiceEndpointStub stub = new DeviceDataServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_
HANDLER, myProtocolHandler);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

49
Chapter 2: Device Data Service

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceDataServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceDataServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
DeviceDataServiceEndpointStub.AWOperationContext operationContext =
new DeviceDataServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);
DeviceDataServiceEndpointStub.EntityKey entityKey=new
DeviceDataServiceEndpointStub.EntityKey();

entityKey.setValue(572);

DeviceDataServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceDataServiceEndpointStub.DeviceEntity();

deviceEntity.setId(entityKey);
DeviceDataServiceEndpointStub.GetSecurityAuditDetails
getSecurityAuditDetails=new
DeviceDataServiceEndpointStub.GetSecurityAuditDetails();

getSecurityAuditDetails.setDeviceEntity(deviceEntity);
getSecurityAuditDetails.setOperationContext(operationContext);
DeviceDataServiceEndpointStub.GetSecurityAuditDetailsResponse
getSecurityAuditDetailsResponse=stub.getSecurityAuditDetails
(getSecurityAuditDetails);
}
catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

50
Chapter 3:
Device Profile Services
InstallDeviceProfile 52
RemoveDeviceProfile 55
CopyProfileToLocationGroup 58
GetDeviceProfileByID 60

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

51
Chapter 3: Device Profile Services

InstallDeviceProfile
This API Installs the specified profile on the device. It will take deviceprofile ID and deviceID as input.

Request Parameters

Response Elements
Boolean value for installed status.

C# Sample Code (Console Application)

static void Main(string[] args)


{
try
{
context = new AWOperationContext()
{
Identity = new ServiceIdentity { Name = "Administrator" }
};
var client = new DeviceProfileServiceClient();
client.Open();
var deviceKey = new EntityKey() {Value = 3939};
var profileKey = new DeviceProfileEntity() { ProfileID = new
EntityKey() {Value = 1234}
};
client.PublishDeviceProfile(deviceKey, profileKey, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

52
Chapter 3: Device Profile Services

Java Sample Code

import javax.net.ssl.SSLContext;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.log4j.BasicConfigurator;
import services.com.air_watch.www.EnrollmentServiceEndpointStub;
import org.apache.commons.httpclient.protocol.Protocol;
import org.jsslutils.sslcontext.X509SSLContextFactory;

// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);

// Key store
KeyStore keyStore = KeyStore.getInstance("JKS");
InputStream keyInput = new FileInputStream(testProps.getProperty
("javax.net.ssl.keyStore"));
keyStore.load(keyInput, "XX-PASSWORD".toCharArray());
keyInput.close();

// Trust Store
KeyStore trustStore = KeyStore.getInstance("JKS");
keyInput = new FileInputStream(testProps.getProperty
("javax.net.ssl.trustStore"));
trustStore.load(keyInput, "XX-PASSWORD".toCharArray());
keyInput.close();

// SSL Context
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(keyStore,
" XX-PASSWORD", trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

// Request Proxy
DeviceProfileServiceEndpointStub stub = new DeviceProfileServiceEndpointStub
();
stub._getServiceClient().engageModule("addressing");

// Create the request. Disable Chunked Transfer


stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try
{
// Set the identity

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

53
Chapter 3: Device Profile Services

DeviceProfileServiceEndpointStub.ServiceIdentity serviceIdentity = new


DeviceProfileServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
DeviceProfileServiceEndpointStub.AWOperationContext operationContext =
new DeviceProfileServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);

// Set the device ID


DeviceProfileServiceEndpointStub.EntityKey deviceKey = new
DeviceProfileServiceEndpointStub.EntityKey();
deviceKey.setValue(4351);
DeviceProfileServiceEndpointStub.DeviceProfileEntity profile = new
DeviceProfileServiceEndpointStub.DeviceProfileEntity() ;

// Set profile ID
DeviceProfileServiceEndpointStub.EntityKey profileKey = new
DeviceProfileServiceEndpointStub.EntityKey();
profileKey.setValue(1820);
profile.setProfileID(profileKey);
InstallDeviceProfile installDeviceProfile = new InstallDeviceProfile();
installDeviceProfile.setDeviceId(deviceKey);
installDeviceProfile.setDeviceProfile(profile);
installDeviceProfile.setOperationContext(operationContext);
stub.installDeviceProfile(installDeviceProfile);
}
catch (Exception ex) {
Logger.getLogger(TestClient.class.getName()).log(Level.SEVERE, null, ex);
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

54
Chapter 3: Device Profile Services

RemoveDeviceProfile
This API deletes the deviceprofile from the device.

Request Parameters:

Response Elements:
Boolean value for removed status.

C# Sample Code (Console Application)

//
static void Main(string[] args)
{
try
{
context = new AWOperationContext()
{
Identity = new ServiceIdentity {Name = "Administrator”}
};
var client = new DeviceProfileServiceClient();
client.Open();
var deviceKey = new EntityKey() {Value = 3939};
var profileKey = new DeviceProfileEntity() { ProfileID = new EntityKey
() {Value = 1234}
};
client.RemoveDeviceProfile(deviceKey, profileKey, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

55
Chapter 3: Device Profile Services

Java Sample Code

import javax.net.ssl.SSLContext;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.log4j.BasicConfigurator;
import services.com.air_watch.www.EnrollmentServiceEndpointStub;
import org.apache.commons.httpclient.protocol.Protocol;
import org.jsslutils.sslcontext.X509SSLContextFactory;

// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);

// Key store
KeyStore keyStore = KeyStore.getInstance("JKS");
InputStream keyInput = new FileInputStream(testProps.getProperty
("javax.net.ssl.keyStore"));
keyStore.load(keyInput, "XX-PASSWORD".toCharArray());
keyInput.close();

// Trust Store
KeyStore trustStore = KeyStore.getInstance("JKS");
keyInput = new FileInputStream(testProps.getProperty
("javax.net.ssl.trustStore"));
trustStore.load(keyInput, "XX-PASSWORD".toCharArray());
keyInput.close();

// SSL Context
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(keyStore,
" XX-PASSWORD", trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

// Request Proxy
DeviceProfileServiceEndpointStub stub = new DeviceProfileServiceEndpointStub
();
stub._getServiceClient().engageModule("addressing");

// Create the request. Disable Chunked Transfer


stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try
{
// Set the identity

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

56
Chapter 3: Device Profile Services

DeviceProfileServiceEndpointStub.ServiceIdentity serviceIdentity = new


DeviceProfileServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
DeviceProfileServiceEndpointStub.AWOperationContext operationContext =
new DeviceProfileServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);

// Set the device ID


DeviceProfileServiceEndpointStub.EntityKey deviceKey = new
DeviceProfileServiceEndpointStub.EntityKey();
deviceKey.setValue(4351);
DeviceProfileServiceEndpointStub.DeviceProfileEntity profile = new
DeviceProfileServiceEndpointStub.DeviceProfileEntity() ;

// Set profile ID
DeviceProfileServiceEndpointStub.EntityKey profileKey = new
DeviceProfileServiceEndpointStub.EntityKey(); profileKey.setValue(1820);
profile.setProfileID(profileKey);
RemoveDeviceProfile removeDeviceProfile = new RemoveDeviceProfile();
removeDeviceProfile.setDeviceId(deviceKey );
removeDeviceProfile.setDeviceProfile(profile);
removeDeviceProfile.setOperationContext(operationContext);
stub.removeDeviceProfile(removeDeviceProfile );
}
catch (Exception ex) {
Logger.getLogger(TestClient.class.getName()).log(Level.SEVERE, null, ex);
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

57
Chapter 3: Device Profile Services

CopyProfileToLocationGroup
Copies the device Profile from one location group to another location group.

Request Parameters:
1. EntityKey: LocationGroup.

2. EntityKey : LocationgroupID

3. AWOperationContext

Response Elements:
Boolean to indicate success/failure.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

58
Chapter 3: Device Profile Services

C# Sample Code (Console Application)

public static void CopyProfileToLocationGroup ()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
DeviceProfileServiceClient client = new DeviceProfileServiceClient();
client.Open();
var profileID = new EntityKey(){ Value = 4563};
var locationGroup = new EntityKey() { Value = 628};
bool success = client.CopyProfileToLocationGroup(profileID,
locationGroup , true,context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

59
Chapter 3: Device Profile Services

GetDeviceProfileByID
Returns the DeviceProfile object searched by profile ID.

Request Parameters:
1. EntityKey : LocationGroup.

2. AWOperationContext

Response Elements:
Returns the DeviceProfileEntity Object.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

60
Chapter 3: Device Profile Services

C# Sample Code (Console Application)

public static void GetDeviceProfileByID()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
DeviceProfileServiceClient client = new DeviceProfileServiceClient();
client.Open();
var profileID = new EntityKey() { Value = 4563 };
DeviceProfileEntity success = client.GetDeviceProfileByID(profileID,
context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

61
Chapter 4:
Device Service
Save 63
Load 67
Search 69
UpdateDevice 74
Device Commands 77
QueryDevice 99
RemoveDevice 103
GetDevicesByIsCompromised 106
GetDeviceSummaryByPasscode 106
GetDeviceSummaryByDataEncryption 107
GetDeviceSummaryByOwnership 107
GetDeviceSummaryByPlatform 107

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

62
Chapter 4: Device Service

Save
This API creates a new device or updates the device information.
l For creating new Device:
o DeviceUId and DeviceType have to be passed along with other information.

l For updating Device information:


o Either DeviceID or combination of DeviceType and DeviceUId is mandatory.

Request Parameters:

1. DeviceEntity

2. AWOperationContext

Response Elements:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

63
Chapter 4: Device Service

C# Sample Code (Console Application)

public static void SaveDevice()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
DeviceServiceClient client = new DeviceServiceClient();

client.Open();
var deviceEntity = new DeviceEntity();
deviceEntity.ActivationCode = "global";
deviceEntity.AssetNumber = "test";
deviceEntity.SerialNumber = "test";
deviceEntity.DeviceUid = "583C3FCC4DE43B41B741BC5CAC82B014";
deviceEntity.DeviceType = new EntityKey(){ Value = 5};
var result = client.Save( deviceEntity, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

64
Chapter 4: Device Service

Java Sample Code

public void saveDevice() throws AxisFault, Exception { String endPointURI =


"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

65
Chapter 4: Device Service

serviceIdentity.setName("Administrator");

DeviceServiceEndpointStub.AWOperationContext operationContext = new


DeviceServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

DeviceServiceEndpointStub.DeviceEntity deviceEntity = new


DeviceServiceEndpointStub.DeviceEntity();

deviceEntity.setActivationCode("global");
deviceEntity.setAssetNumber("prabhutest");
deviceEntity.setSerialNumber("prabhutest");
deviceEntity.setDeviceUid("583C3FCC4DE43B41B741BC5CAC82B014");
DeviceServiceEndpointStub.EntityKey entityKey = new
DeviceServiceEndpointStub.EntityKey();

entityKey.setValue(5);
deviceEntity.setDeviceType(entityKey);
DeviceServiceEndpointStub.Save save=new DeviceServiceEndpointStub.Save
();
save.setDeviceEntity(deviceEntity);
save.setOperationContext(operationContext);
DeviceServiceEndpointStub.SaveResponse saveResponse=stub.save(save);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

66
Chapter 4: Device Service

Load
Loads the device based on deviceID.

Request Parameters:
1. DeviceID

2. AWOperationContext

Response Elements:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

67
Chapter 4: Device Service

C# Sample Code (Console Application)

public static void LoadDevice()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
DeviceServiceClient client = new DeviceServiceClient();
client.Open();
DeviceEntity result = client.Load(new EntityKey() {Value = 4516},
context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void load() throws AxisFault, Exception { String endPointURI =


"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

68
Chapter 4: Device Service

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
DeviceServiceEndpointStub.AWOperationContext operationContext =
new DeviceServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);
DeviceServiceEndpointStub.EntityKey entityKey = new
DeviceServiceEndpointStub.EntityKey();

entityKey.setValue(4694);
DeviceServiceEndpointStub.Load load=new
DeviceServiceEndpointStub.Load();

load.setEntityKey(entityKey); load.setOperationContext
(operationContext); DeviceServiceEndpointStub.LoadResponse
loadResponse=stub.load(load);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

Search
Searches for the device according to the search criteria.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

69
Chapter 4: Device Service

Request Parameters:
1. DeviceSearchCriteria.

Note: If the property Exactmatch is true then it searches for exact string match or else it will use like operator to
match.

2. AWOperationContext

Response Elements:
1. DeviceSearchResult.

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

70
Chapter 4: Device Service

using System.Linq;
using System.Text;
using Device.DeviceService;
namespace Device
{
class DeviceSearch
{
static void Main(string[] args)
{
try
{
DeviceServiceClient client = new DeviceServiceClient();

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

const string userName = "Administrator";


var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };
// Device's Friendly name
String deviceFriendlyName = "Lotty's iPhone";
DeviceSearchCriteria criteria = new DeviceSearchCriteria() {
FriendlyName = deviceFriendlyName };
DeviceSearchResult[] results = client.Search(criteria,
operationContext);
if (results != null)
{
Console.WriteLine("Device Search is successfull. Press any
key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Device Search failed. Please try again.
Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

71
Chapter 4: Device Service

Java Sample Code

public void searchDevice() throws AxisFault, Exception { String endPointURI =


"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub(); stub._


getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
DeviceServiceEndpointStub.AWOperationContext operationContext =
new DeviceServiceEndpointStub.AWOperationContext();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

72
Chapter 4: Device Service

operationContext.setIdentity(serviceIdentity);
DeviceServiceEndpointStub.DeviceSearchCriteria
deviceSearchCriteria = new
DeviceServiceEndpointStub.DeviceSearchCriteria();
deviceSearchCriteria.setFriendlyName("Brandon’s iPhone");
deviceSearchCriteria.setSerialNumber("320021D13NP");
deviceSearchCriteria.setExactMatch(true);

DeviceServiceEndpointStub.Search search=new
DeviceServiceEndpointStub.Search(); search.setSearchCriteria
(deviceSearchCriteria); search.setOperationContext
(operationContext); DeviceServiceEndpointStub.SearchResponse
queryDeviceResponses=stub.search(search);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

73
Chapter 4: Device Service

UpdateDevice
This method is added specifically to Pinecone integration. Is used to update the device extended details in the AirWatch
DB. This method is different from the Save method in a way that, it only does the update/insertion specific to
extendedField specified in the deviceEntity input.

Request Parameters:
1. Device Entity:

Response Elements:
1. Device ID

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

74
Chapter 4: Device Service

C# Sample Code (Console Application)

public static void UpdateDevice()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
DeviceServiceClient client = new DeviceServiceClient();
client.Open();
var deviceEntity = new DeviceEntity();

deviceEntity.DeviceUid = "583C3FCC4DE43B41B741BC5CAC82B014";
deviceEntity.DeviceType = new EntityKey() { Value = 5 };
deviceEntity.DeviceExtendedField = "L";
// Set 'L'
var result = client.UpdateDevice(deviceEntity);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void updateDevice() throws AxisFault, Exception { String endPointURI =


"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile = "D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";


InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin"; keyStore.load(keyInput,


keyStrorePassword.toCharArray()); keyInput.close();

String trustStoreFile = "D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";


KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

75
Chapter 4: Device Service

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(keyStore,


keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity(); serviceIdentity.setName
("Administrator"); DeviceServiceEndpointStub.AWOperationContext
operationContext = new DeviceServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);
DeviceServiceEndpointStub.DeviceEntity deviceEntity = new
DeviceServiceEndpointStub.DeviceEntity();

deviceEntity.setDeviceUid("583C3FCC4DE43B41B741BC5CAC82B014");
DeviceServiceEndpointStub.EntityKey entityKey = new
DeviceServiceEndpointStub.EntityKey(); entityKey.setValue(5);
deviceEntity.setDeviceType(entityKey);

deviceEntity.setDeviceExtendedField("L");
DeviceServiceEndpointStub.UpdateDevice updateDevice=new
DeviceServiceEndpointStub.UpdateDevice();
updateDevice.setDeviceEntityTransport(deviceEntity);
DeviceServiceEndpointStub.UpdateDeviceResponse
updateDeviceResponse=stub.updateDevice(updateDevice);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

76
Chapter 4: Device Service

Device Commands
LockDevice

Request Parameters:
1. Device Entity

2. Operation Context

Response Elements:
DeviceLock method returns a Boolean value true/false as output parameter indicating success/failure of the Device
Command operation.
This method is used for remotely locking an enrolled device.

LockDevice Method Signature


public bool LockDevice(DeviceEntityTransport deviceEntity, AWOperationContextTransport operationContext)

Input Parameters
deviceEntity: This corresponds to the device details. Obligatory fields for deviceEntity are DeviceUid (with data type as
string) or DeviceId (integer), ActivationCode (string) and DeviceType (entity key with value as integer).
operationContext: This describes the user context for the end user performing the device lock operation.

C# Sample Code for LockDevice (Console Application)

using System;
using System.Collections.Generic;

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

77
Chapter 4: Device Service

using System.Linq;
using System.Text;
using DeviceCommands.DeviceService;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace DeviceCommands { class LockDevice { static void Main(string[] args)
{
try
{
// An instance of DeviceEntity holds the device details.

/* Either DeviceUid or DeviceId(denoted as Id) can be


specified for constructing the DeviceEntity*/

var deviceEntity = new DeviceEntity { Id = new EntityKey {


Value = 23960 }, DeviceUid =
"1AB0485284BG24789G356734FGHJ2345", DeviceType = new EntityKey
{ Value = 4 }, ActivationCode = "demo" };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

AWOperationContext operationContext = new AWOperationContext


();

operationContext.Identity = new ServiceIdentity { Name =


"Administrator" };

// Create an instance of DeviceServiceClient.


DeviceServiceClient client = new DeviceServiceClient();

// Return type of LockDevice method is a boolean value.


bool result = client.LockDevice(deviceEntity,
operationContext);
if (result)
{
Console.WriteLine("DeviceLock successful. Press any key to
continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("DeviceLock unsuccessful. Press any key
to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

78
Chapter 4: Device Service

}
}
}
}

Java Sample Code for LockDevice (Console Application)

public void lockDevice() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

79
Chapter 4: Device Service

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER,myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
DeviceServiceEndpointStub.AWOperationContext operationContext =
new DeviceServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

DeviceServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceServiceEndpointStub.DeviceEntity();

deviceEntity.setActivationCode("demo");

deviceEntity.setDeviceUid("1AB0485284BG24789G356734FGHJ2345");
DeviceServiceEndpointStub.EntityKey deviceEntityKey=new
DeviceServiceEndpointStub.EntityKey();
deviceEntityKey.setValue(23960);
deviceEntity.setId(deviceEntityKey);
DeviceServiceEndpointStub.EntityKey deviceTypeEntityKey=new
DeviceServiceEndpointStub.EntityKey();
deviceTypeEntityKey.setValue(4);
deviceEntity.setDeviceType(deviceTypeEntityKey);

DeviceServiceEndpointStub.LockDevice lockDevice=new
DeviceServiceEndpointStub.LockDevice();

lockDevice.setDeviceEntity(deviceEntity);
lockDevice.setOperationContext(operationContext);
DeviceServiceEndpointStub.LockDeviceResponse
lockDeviceResponse=stub.lockDevice(lockDevice);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

80
Chapter 4: Device Service

ClearPasscode
Request Parameters:

Response Elements:
ClearPasscode method returns a Boolean value true/false as output parameter indicating success/failure of the Device
Command operation.
This method is used for clearing the passcode (i.e. password) for an enrolled device.

ClearPasscode Method Signature


public bool ClearPasscode (DeviceEntityTransport deviceEntity, AWOperationContextTransport operationContext)

Input Parameters
deviceEntity: This corresponds to the device details. Mandatory fields for deviceEntity are DeviceUid (with data type as
string) or DeviceId (integer), ActivationCode (string) and DeviceType (entity key with value as integer)
operationContext: This describes the user context for the end user performing the clear passcode operation.

C# Sample Code for ClearPasscode (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceCommands.DeviceService;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace DeviceCommands
{
class ClearPasscode
{

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

81
Chapter 4: Device Service

static void Main(string[] args)


{
try
{
// An instance of DeviceEntity holds the device details.
/* Either DeviceUid or DeviceId(denoted as Id) can be specified
for constructing the DeviceEntity*/

var deviceEntity = new DeviceEntity { Id = new EntityKey { Value =


23960 }, DeviceUid = "1AB0485284BG24789G356734FGHJ2345",
DeviceType = new EntityKey { Value = 4 }, ActivationCode = "demo"
};

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

AWOperationContext operationContext = new AWOperationContext();

operationContext.Identity = new ServiceIdentity { Name =


"Administrator" };

// Create an instance of DeviceServiceClient.


DeviceServiceClient client = new DeviceServiceClient();

// Return type of ClearPasscode method is a boolean value.


bool result = client.ClearPasscode(deviceEntity,
operationContext);
if (result)
{
Console.WriteLine("ClearPasscode successful. Press any key to
continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("ClearPasscode unsuccessful. Press any key
to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

82
Chapter 4: Device Service

Java Sample Code for ClearPasscode

public void clearPasscode() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");
String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER,myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

83
Chapter 4: Device Service

try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
DeviceServiceEndpointStub.AWOperationContext operationContext = new
DeviceServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);
DeviceServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceServiceEndpointStub.DeviceEntity();

deviceEntity.setActivationCode("demo");
deviceEntity.setDeviceUid("1AB0485284BG24789G356734FGHJ2345");
DeviceServiceEndpointStub.EntityKey deviceEntityKey=new
DeviceServiceEndpointStub.EntityKey();

deviceEntityKey.setValue(23960);
deviceEntity.setId(deviceEntityKey);

DeviceServiceEndpointStub.EntityKey deviceTypeEntityKey=new
DeviceServiceEndpointStub.EntityKey();
deviceTypeEntityKey.setValue(4);
deviceEntity.setDeviceType(deviceTypeEntityKey);
DeviceServiceEndpointStub.ClearPasscode clearPasscode=new
DeviceServiceEndpointStub.ClearPasscode();

clearPasscode.setDeviceEntity(deviceEntity);
clearPasscode.setOperationContext(operationContext);

DeviceServiceEndpointStub.ClearPasscodeResponse
clearPasscodeResponse=stub.clearPasscode(clearPasscode);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); }
}

DeviceWipe
Request Parameters:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

84
Chapter 4: Device Service

Response Elements:
DeviceWipe method returns a Boolean value true/false as output parameter indicating success/failure of the Device
Command operation.
This method is used to wipe an enrolled device remotely.

DeviceWipe Method Signature


public bool DeviceWipe (DeviceEntityTransport deviceEntity, AWOperationContextTransport operationContext)

Input Parameters
DeviceEntity: This corresponds to the device details. Mandatory fields for deviceEntity are DeviceUid (with data type as
string) or DeviceId (integer), ActivationCode (string) and DeviceType (entity key with value as integer)
OperationContext: This describes the user context for the end user performing the device wipe operation.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

85
Chapter 4: Device Service

C# Sample Code for DeviceWipe (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceCommands.DeviceService;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace DeviceCommands
{
class DeviceWipe
{
static void Main(string[] args)
{
try
{
// An instance of DeviceEntity holds the device details.
/* Either DeviceUid or DeviceId(denoted as Id) can be
specified for constructing the DeviceEntity*/

var deviceEntity = new DeviceEntity { Id = new EntityKey {


Value = 23960 }, DeviceUid =
"1AB0485284BG24789G356734FGHJ2345", DeviceType = new EntityKey
{ Value = 4 }, ActivationCode = "demo" };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

AWOperationContext operationContext = new AWOperationContext


();

operationContext.Identity = new ServiceIdentity { Name =


"Administrator" };

//Create an instance of DeviceServiceClient.


DeviceServiceClient client = new DeviceServiceClient();

// Return type of DeviceWipe method is a boolean value.


bool result = client.DeviceWipe(deviceEntity,
operationContext);

if (result)
{
Console.WriteLine("DeviceWipe successful. Press any key to
continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("DeviceWipe unsuccessful. Press any key

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

86
Chapter 4: Device Service

to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code for DeviceWipe (Console Application)

public void deviceWipe() throws AxisFault, Exception { String endPointURI =


"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

87
Chapter 4: Device Service

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient()
.getOptions()
=.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

DeviceServiceEndpointStub.AWOperationContext operationContext = new


DeviceServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);
DeviceServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceServiceEndpointStub.DeviceEntity();

deviceEntity.setActivationCode("demo");
deviceEntity.setDeviceUid("1AB0485284BG24789G356734FGHJ2345");

DeviceServiceEndpointStub.EntityKey deviceEntityKey=new
DeviceServiceEndpointStub.EntityKey();

deviceEntityKey.setValue(23960);
deviceEntity.setId(deviceEntityKey);
DeviceServiceEndpointStub.EntityKey deviceTypeEntityKey=new
DeviceServiceEndpointStub.EntityKey();
deviceTypeEntityKey.setValue(4);

deviceEntity.setDeviceType(deviceTypeEntityKey);

DeviceServiceEndpointStub.DeviceWipe deviceWipe=new
DeviceServiceEndpointStub.DeviceWipe();

deviceWipe.setDeviceEntity(deviceEntity);
deviceWipe.setOperationContext(operationContext);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

88
Chapter 4: Device Service

DeviceServiceEndpointStub.DeviceWipeResponse
deviceWipeResponse=stub.deviceWipe(deviceWipe);
}

catch (Exception ex)


{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

UnenrollDevice
Request Parameters:

Response Elements:
UnenrollDevice method returns a Boolean value true/false as output parameter indicating success/failure of the Device
Command operation.
This method is used for unenrolling an enrolled device.

UnenrollDevice Method Signature


public bool UnenrollDevice (DeviceEntityTransport deviceEntity, AWOperationContextTransport operationContext)

Input Parameters
DeviceEntity: This corresponds to the device details. Mandatory fields for deviceEntity are DeviceUid (with data type as
string), ActivationCode (string) and DeviceType (entity key with value as integer)

C# Sample Code for UnenrollDevice (Console Application)

using System;

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

89
Chapter 4: Device Service

using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceCommands.DeviceService;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace DeviceCommands
{
class UnenrollDevice
{
static void Main(string[] args)
{
try
{
// An instance of DeviceEntity holds the device details.
/* Either DeviceUid or DeviceId(denoted as Id) can be specified
for constructing the DeviceEntity*/

var deviceEntity = new DeviceEntity { Id = new EntityKey { Value =


23960 }, DeviceUid = "1AB0485284BG24789G356734FGHJ2345",
DeviceType = new EntityKey { Value = 4 }, ActivationCode = "demo"
};

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

AWOperationContext operationContext = new AWOperationContext();

operationContext.Identity = new ServiceIdentity { Name =


"Administrator" };

// Create an instance of DeviceServiceClient.


DeviceServiceClient client = new DeviceServiceClient();

// Return type of UnenrollDevice method is a boolean value.


bool result = client.UnenrollDevice(deviceEntity,
operationContext);

if (result)
{
Console.WriteLine("UnenrollDevice successful. Press any key to
continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("UnenrollDevice unsuccessful. Press any key
to continue..");
Console.ReadLine();
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

90
Chapter 4: Device Service

}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

SendMessage
Request Parameters:

Response Elements:
SendMessage method returns a Boolean value true/false as output parameter indicating success/failure of the Device
Command operation.
This method is used for sending a text message to an enrolled device.

DeviceWipe Method Signature


public bool SendMessage(DeviceEntityTransport deviceEntity, AWOperationContextTransport operationContext)

Input Parameters
DeviceEntity: This corresponds to the device details. Mandatory fields for deviceEntity are DeviceUid(with data type as
string) or DeviceId (integer), ActivationCode (string), DeviceType (entity key with value as integer), PhoneNumber and
MessageBody (both with data type as string).
OperationContext: This describes the user context for the end user performing the send message operation.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

91
Chapter 4: Device Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeviceCommands.DeviceService;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace DeviceCommands
{
class SendMessage
{
static void Main(string[] args)
{
try
{
// An instance of DeviceEntity holds the device details.
/* Either DeviceUid or DeviceId(denoted as Id) can be
specified for constructing the DeviceEntity*/

var deviceEntity = new DeviceEntity { Id = new EntityKey {


Value = 23960 }, DeviceUid =
"1AB0485284BG24789G356734FGHJ2345", DeviceType = new EntityKey
{ Value = 4 }, ActivationCode = "demo" };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

AWOperationContext operationContext = new AWOperationContext


();

operationContext.Identity = new ServiceIdentity { Name =


"Administrator" };

// Create an instance of DeviceServiceClient.


DeviceServiceClient client = new DeviceServiceClient();

// Return type of SendMessage method is a boolean value.


bool result = client.SendMessage(deviceEntity,
operationContext);
if (result)
{
Console.WriteLine("SendMessage successful. Press any key to
continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("SendMessage unsuccessful. Press any key
to continue..");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

92
Chapter 4: Device Service

Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code (Console Application)

public void sendMessage() throws AxisFault, Exception { String endPointURI =


"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory
(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext,false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

93
Chapter 4: Device Service

stub._getServiceClient()
.getOptions()
.setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER,myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
DeviceServiceEndpointStub.AWOperationContext operationContext = new
DeviceServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

DeviceServiceEndpointStub.DeviceEntity deviceEntity=new
DeviceServiceEndpointStub.DeviceEntity();

deviceEntity.setActivationCode("demo");
deviceEntity.setDeviceUid("1AB0485284BG24789G356734FGHJ2345");
DeviceServiceEndpointStub.EntityKey deviceEntityKey=new
DeviceServiceEndpointStub.EntityKey();

deviceEntityKey.setValue(23960);
deviceEntity.setId(deviceEntityKey);

DeviceServiceEndpointStub.EntityKey deviceTypeEntityKey=new
DeviceServiceEndpointStub.EntityKey();

deviceTypeEntityKey.setValue(4);

deviceEntity.setDeviceType(deviceTypeEntityKey);

DeviceServiceEndpointStub.SendMessage sendMessage =new


DeviceServiceEndpointStub.SendMessage();

sendMessage.setDeviceEntity(deviceEntity);

sendMessage.setOperationContext(operationContext);

DeviceServiceEndpointStub.SendMessageResponse
deviceWipeResponse=stub.sendMessage(sendMessage);
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

94
Chapter 4: Device Service

catch (Exception ex)


{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

95
Chapter 4: Device Service

GetDevicesByLocationGroup
This API returns the array of devices present in the specified locationGroup. It returns in the array of
DeviceDashboardSummary objects.

Request Parameters:

Response Elements:

Note:
l OwnershipAbbr: This attribute informs about the ownership of the Device. Possible values are:
o C - Corporate dedicated
o S - Corparate shared
o E - Employee owned

l Empty/null value indicates undified.

l FriendlyName - It is the friendly name of device

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

96
Chapter 4: Device Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Device.DeviceService;
namespace Device
{
class DevicesByLG
{
static void Main(string[] args)
{
try
{
// Create an instance of DeviceServiceClient
DeviceServiceClient client = new DeviceServiceClient();

// Entity key for Location Group


const int locationGrpId = 2897;EntityKey locationGroupId = new
EntityKey { Value = locationGrpId };

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

const string userName = "Administrator";


var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };
var result = client.GetDevicesByLocationGroup(locationGroupId,
operationContext);
if (result != null)
{
Console.WriteLine("Devices are successfully loaded for the
location group. Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Devices failed to load. Please try
again. Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

97
Chapter 4: Device Service

Java Sample Code (Console Application)

public void getDevicesByLocationGroup() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");
keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();


Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

98
Chapter 4: Device Service

DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new


DeviceServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

DeviceServiceEndpointStub.AWOperationContext operationContext = new


DeviceServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

DeviceServiceEndpointStub.EntityKey locationEntityKey=new
DeviceServiceEndpointStub.EntityKey();

locationEntityKey.setValue(631);

DeviceServiceEndpointStub.GetDevicesByLocationGroup
getDevicesByLocationGroup=new
DeviceServiceEndpointStub.GetDevicesByLocationGroup();

getDevicesByLocationGroup.setLocationGroupId(locationEntityKey);

getDevicesByLocationGroup.setOperationContext(operationContext);

DeviceServiceEndpointStub.GetDevicesByLocationGroupResponse
getDevicesByLocationGroupResponse=stub.getDevicesByLocationGroup
(getDevicesByLocationGroup);

}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

QueryDevice
Queries the device and returns a Boolean success/failure.

Request Parameters:
1. DeviceEntity: Qeury device is based on DeviceID. If DeviceID is null then based on DeviceType and deviceUID it
performs deviceQuery. ActivationCode is required.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

99
Chapter 4: Device Service

2. AWOperationContext

Response Elements:
Boolean value.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

100
Chapter 4: Device Service

C# Sample Code (Console Application)

public static void QueryDevice()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
DeviceServiceClient client = new DeviceServiceClient();
client.Open();
var device = new DeviceEntity();
device.ActivationCode = "global";
device.Id = new EntityKey(){ Value = 4589};
bool result = client.QueryDevice(device, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code (Console Application)

public void queryDevice() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

101
Chapter 4: Device Service

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER,myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {

DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new


DeviceServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

DeviceServiceEndpointStub.AWOperationContext operationContext = new


DeviceServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

DeviceServiceEndpointStub.DeviceEntity deviceEntity = new


DeviceServiceEndpointStub.DeviceEntity();

DeviceServiceEndpointStub.EntityKey idEntityKey = new


DeviceServiceEndpointStub.EntityKey();

idEntityKey.setValue(4589);

deviceEntity.setActivationCode("global");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

102
Chapter 4: Device Service

DeviceServiceEndpointStub.QueryDevice queryDevice=new
DeviceServiceEndpointStub.QueryDevice();

queryDevice.setDeviceEntity(deviceEntity);

queryDevice.setOperationContext(operationContext);

DeviceServiceEndpointStub.QueryDeviceResponse
queryDeviceResponses=stub.queryDevice(queryDevice);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

RemoveDevice
Removes the device from AirWatch DB.

Request Parameters:
1. EntityKey : DeviceID

2. AWOperationContext

Response Elements:
Returns true/false depending on deletion success.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

103
Chapter 4: Device Service

C# Sample Code (Console Application)

public static void RemoveDevice()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
DeviceServiceClient client = new DeviceServiceClient();
client.Open();
var deviceID = new EntityKey() { Value = 4589 };
var result = client.RemoveDevice(deviceID, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code (Console Application)

public void removeDevice() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/DeviceServiceEndpoint
.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();
String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

104
Chapter 4: Device Service

String trustStorePassword = "changeit";


trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory
(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

DeviceServiceEndpointStub stub = new DeviceServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER,myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
DeviceServiceEndpointStub.ServiceIdentity serviceIdentity = new
DeviceServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
DeviceServiceEndpointStub.AWOperationContext operationContext = new
DeviceServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);

DeviceServiceEndpointStub.EntityKey entityKey = new


DeviceServiceEndpointStub.EntityKey();

entityKey.setValue(4694);

DeviceServiceEndpointStub.RemoveDevice removeDevice=new
DeviceServiceEndpointStub.RemoveDevice();

removeDevice.setDeviceId(entityKey);
removeDevice.setOperationContext(operationContext);
DeviceServiceEndpointStub.RemoveDeviceResponse
loadResponse=stub.removeDevice(removeDevice);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

105
Chapter 4: Device Service

GetDevicesByIsCompromised
Returns a device count for a location group for various compromised statuses. Location group will be derived from the
client certificate used to make the API call.

Request Parameters:
No Input

Response Elements:
Dictionary<string, int>

GetDeviceSummaryByPasscode
Returns a device count for a location group for various passcode statuses. Location group will be derived from the client
certificate used to make the API call.

Request Parameters:
No Input

Response Elements:
Dictionary<string, int>

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

106
Chapter 4: Device Service

GetDeviceSummaryByDataEncryption
Returns a device count for a location group for various data encryption statuses.Location group will be derived from the
client certificate used to make the API call.

Request Parameters:
No Input.

Response Elements:
Dictionary<string, int>

GetDeviceSummaryByOwnership
Returns a device count for a location group for various data encryption statuses.Location group will be derived from the
client certificate used to make the API call.

Request Parameters:

Response Elements:
Dictionary<string, int>

GetDeviceSummaryByPlatform
Returns a device count for a location group for various platforms.Location group will be derived from the client certificate
used to make the API call.

Request Parameters:
No Input.

Response Elements:
Dictionary<string, int>

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

107
Chapter 5:
Enrollment Service
Overview 109
RegisterEnrollmentUser 109
RegisterDeviceForUser 111
RemoveEnrollmentUser 116
PublishUserProfiles 121
LoadEnrolledDeviceUser 125

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

108
Chapter 5: Enrollment Service

Overview
This service provides access to business functionality related to Enrollment management. It provides methods to create a
new enrollment user and associate a device with a particular user.

RegisterEnrollmentUser
Request Parameters:

Response Elements:
None

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enrollment.EnrollmentService;
namespace Enrollment
{
class EnrollUser
{
static void Main(string[] args)
{
try
{
// Create an instance of EnrollmentServiceClient
EnrollmentServiceClient client = new EnrollmentServiceClient
();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

109
Chapter 5: Enrollment Service

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
AWOperationContext operationContext = new AWOperationContext
{
Identity = new ServiceIdentity { Name = userName }
};
EnrollmentUserEntity userEntity = new EnrollmentUserEntity();
userEntity.ConcurrencyId = new ConcurrencyIdentifier { Value =
new Guid()
};
userEntity.EmailAddress = "[email protected]";
userEntity.FirstName = "John"; userEntity.LastName = "Doe";
userEntity.ActivationCode = "Demo"; userEntity.PhoneNumber =
"5038962329"; userEntity.Username = "Test_Enrollment_User";
userEntity.UserPassword = "testuser";
userEntity.Authentication =
EnrollmentUserAuthenticationType.Directory;
userEntity.MessageType = MessageType.Email;

// Actual Service Call


client.RegisterEnrollmentUser(userEntity, operationContext);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code

public void registerEnrollmentUser()


{
EnrollmentServiceEndpointStub.RegisterEnrollmentUser request = new
EnrollmentServiceEndpointStub.RegisterEnrollmentUser();

EnrollmentServiceEndpointStub.ServiceIdentity serviceIdentity = new


EnrollmentServiceEndpointStub.ServiceIdentity();

EnrollmentServiceEndpointStub.AWOperationContext operationContext = new


EnrollmentServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);
EnrollmentServiceEndpointStub.EnrollmentUserEntity userEntity = new
EnrollmentServiceEndpointStub.EnrollmentUserEntity();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

110
Chapter 5: Enrollment Service

userEntity.setActivationCode("demo");
userEntity.setAuthentication
(EnrollmentServiceEndpointStub.EnrollmentUserAuthenticationType.Basic);

EnrollmentServiceEndpointStub.Guid guid = new


EnrollmentServiceEndpointStub.Guid();

guid.setGuid(UUID.randomUUID().toString());

EnrollmentServiceEndpointStub.ConcurrencyIdentifier concurrencyIdentifier
= new EnrollmentServiceEndpointStub.ConcurrencyIdentifier();

concurrencyIdentifier.setValue(guid);

userEntity.setConcurrencyId(concurrencyIdentifier);
userEntity.setEmailAddress("[email protected]"); userEntity.setFirstName
("John"); userEntity.setLastName("Doe"); userEntity.setPhoneNumber
("123456789"); userEntity.setUsername("user");
userEntity.setUserPassword("password");
EnrollmentServiceEndpointStub.ConcurrentEntityReference entityReference =
new EnrollmentServiceEndpointStub.ConcurrentEntityReference();

EnrollmentServiceEndpointStub.EntityKey entityKey = new


EnrollmentServiceEndpointStub.EntityKey();
entityKey.setValue(7);
entityReference.setId(entityKey);
userEntity.setLocationGroupReference(entityReference);
EnrollmentServiceEndpointStub.EntityKey entityKey1 = new
EnrollmentServiceEndpointStub.EntityKey();

entityKey1.setValue(1);
userEntity.setId(entityKey1);
request.setOperationContext(operationContext);
request.setUserEntityTransport(userEntity);

// Invoke the service


EnrollmentServiceEndpointStub.RegisterEnrollmentUserResponse response =
new EnrollmentServiceEndpointStub.RegisterEnrollmentUserResponse();
try
{
response = stub.registerEnrollmentUser(request);
}
catch(Exception ex)
{
Logger.getLogger(TestClient.class.getName()).log(Level.SEVERE, null,
ex);
}
}

RegisterDeviceForUser
Associates a device to an enrollment user. If the user does not exist, it creates a new enrollment user.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

111
Chapter 5: Enrollment Service

Request Parameters:
1. EnrollmentUserEntity

2. EnrollmentDeviceEntity

3. AWOperationContext

Response Elements:
No response.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

112
Chapter 5: Enrollment Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enrollment.EnrollmentService;
namespace Enrollment
{
class RegisterDevice
{
static void Main(string[] args)
{
try
{
// Create an instance of EnrollmentServiceClient
EnrollmentServiceClient client = new EnrollmentServiceClient
();

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

const string userName = "Administrator";


AWOperationContext operationContext = new AWOperationContext
{
Identity = new ServiceIdentity { Name = userName }
};
//User Details
EnrollmentUserEntity user = new EnrollmentUserEntity();
user.Username = "Enrollment_User_Test"; user.UserPassword =
"testuser"; user.ActivationCode = "Demo";

user.Authentication = EnrollmentUserAuthenticationType.Basic;
user.MessageType = MessageType.Email;

// Details of to-be Enrolled Device


EnrollmentDeviceEntity device = new EnrollmentDeviceEntity();
device.InternationMobileEquipmentIdentity = "IMEI0012";
device.DevicePlatform = "Apple";
device.SerialNumber = "Huhkhfd87hkh";
device.SubscriberIdentityModule = "ATT"; device.Udid =
"YIYUDYF8767DSFHDSU878HFSY7I78"; device.DeviceModel =
"Iphone";

device.DeviceOperatingSystem = "iOS4.3";

// Actual Service Call


client.RegisterDeviceForUser(user, device, operationContext);
}
catch (Exception ex)
{

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

113
Chapter 5: Enrollment Service

Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

114
Chapter 5: Enrollment Service

Java Sample Code

private void populateEnrollmentDeviceRequest(


EnrollmentServiceEndpointStub.RegisterDeviceForUser request,
PicklistServiceEndpointStub.OwnershipListItem[] listItems)
{
/* Setting Server Identity */

EnrollmentServiceEndpointStub.ServiceIdentity serviceIdentity = new


EnrollmentServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
EnrollmentServiceEndpointStub.AWOperationContext operationContext = new
EnrollmentServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);
request.setOperationContext(operationContext);

/*------*/
/*Setting Enrollment User */

EnrollmentServiceEndpointStub.EnrollmentUserEntity userEntity = new


EnrollmentServiceEndpointStub.EnrollmentUserEntity();

userEntity.setActivationCode("Apple");
userEntity.setAuthentication
(EnrollmentServiceEndpointStub.EnrollmentUserAuthenticationType.Basic);

EnrollmentServiceEndpointStub.Guid guid = new


EnrollmentServiceEndpointStub.Guid();

guid.setGuid(UUID.randomUUID().toString());
EnrollmentServiceEndpointStub.ConcurrencyIdentifier concurrencyIdentifier =
new EnrollmentServiceEndpointStub.ConcurrencyIdentifier();

concurrencyIdentifier.setValue(guid);
userEntity.setConcurrencyId(concurrencyIdentifier);

userEntity.setAuthentication
(EnrollmentServiceEndpointStub.EnrollmentUserAuthenticationType.TokenOnly);
userEntity.setEmailAddress("[email protected]");

userEntity.setFirstName("First");
userEntity.setLastName("Last");
userEntity.setPhoneNumber("");
userEntity.setUsername("TestEU");
userEntity.setUserPassword("");
request.setUserEntityTransport(userEntity);
/*------*/
/*Setting Enrollment Device*/

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

115
Chapter 5: Enrollment Service

EnrollmentServiceEndpointStub.EnrollmentDeviceEntity deviceEntity = new


EnrollmentServiceEndpointStub.EnrollmentDeviceEntity();

deviceEntity.setAssetNumber("AN001"); deviceEntity.setDeviceModel("iPhone");
deviceEntity.setDeviceOperatingSystem("iOS 4.0");

deviceEntity.setDevicePlatform("Apple");

deviceEntity.setInternationMobileEquipmentIdentity("IMEI001122");

deviceEntity.setSerialNumber("SN00998877");

deviceEntity.setSubscriberIdentityModule("ATT");

deviceEntity.setUdid("TGJHGFJGSD8345634RGRE5654");
EnrollmentServiceEndpointStub.OwnershipListItem ownership = new
EnrollmentServiceEndpointStub.OwnershipListItem();

EnrollmentServiceEndpointStub.EntityKey ownerEntityKey = new


EnrollmentServiceEndpointStub.EntityKey();

/*loop through the listItems and find the ownership by Text - "C", "E" or "S"
*/
/* sample code uses listItems[0] */

System.out.println("ID =" +listItems[0].getId().getValue());


ownerEntityKey.setValue(listItems[0].getId().getValue());
ownership.setId(ownerEntityKey);
System.out.println("Description =" +listItems[0].getDescription());

ownership.setDescription(listItems[0].getDescription());

System.out.println("SortOrder =" +listItems[0].getSortOrder());

ownership.setSortOrder(listItems[0].getSortOrder());

System.out.println("Text =" +listItems[0].getText());


ownership.setText(listItems[0].getText());

System.out.println("Value =" +listItems[0].getValue());

ownership.setValue(listItems[0].getValue());

deviceEntity.setOwnership(ownership);

request.setDeviceEntityTransport(deviceEntity);

RemoveEnrollmentUser
Using this API below actions can be performed.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

116
Chapter 5: Enrollment Service

User Actions:
1. Deactivate User

2. Delete User
Device Actions:
1. Wipe all the devices associated to the User

2. Enterprise wipe all the devices associated to the user.

Request Parameters:
1. RemoveEnrollmentUserRequest

2. AWOperationContext

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

117
Chapter 5: Enrollment Service

C# Sample Code (Console Application)

public void RemoveEnrollmentUser()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
EnrollmentServiceClient client = new EnrollmentServiceClient();
client.Open();
var userRemove = new RemoveEnrollmentUserRequest();

// Enrollment USer name to be removed


userRemove.Username = "winUser";

// Customer code of the locationgroup


userRemove.ActivationCode = "adam";

// This action is applicable for all devices for the user


userRemove.RemoveUserDeviceAction = RemoveUserDeviceActions.None;

// user action.
userRemove.RemoveUserAction = RemoveUserActions.DeleteUser;
client.RemoveEnrollmentUser(userRemove, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

118
Chapter 5: Enrollment Service

Java Sample Code

public void removeEnrollmentUser() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/EnrollmentServiceEndp
oint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);
String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();
String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");
keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";


trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory
(keyStore, keyStrorePassword.toCharArray(), trustStore); SSLContext
sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
EnrollmentServiceEndpointStub stub = new EnrollmentServiceEndpointStub();
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {

EnrollmentServiceEndpointStub.ServiceIdentity serviceIdentity = new


EnrollmentServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

119
Chapter 5: Enrollment Service

EnrollmentServiceEndpointStub.AWOperationContext operationContext =
new EnrollmentServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

EnrollmentServiceEndpointStub.RemoveEnrollmentUserRequest
removeEnrollmentUserRequest = new
EnrollmentServiceEndpointStub.RemoveEnrollmentUserRequest();

removeEnrollmentUserRequest.setUsername("prabhu");

removeEnrollmentUserRequest.setActivationCode("global");

removeEnrollmentUserRequest
.setRemoveUserDeviceAction
(EnrollmentServiceEndpointStub.RemoveUserDeviceActions.None);

removeEnrollmentUserRequest
.setRemoveUserAction
(EnrollmentServiceEndpointStub.RemoveUserActions.DeleteUser);

EnrollmentServiceEndpointStub.RemoveEnrollmentUser
removeEnrollmentUser = new
EnrollmentServiceEndpointStub.RemoveEnrollmentUser();

removeEnrollmentUser .setUserRequestTransport
(removeEnrollmentUserRequest);

removeEnrollmentUser.setOperationContext(operationContext);

stub.removeEnrollmentUser(removeEnrollmentUser);
}
catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

120
Chapter 5: Enrollment Service

PublishUserProfiles
This API publishes the profile for all the Devices enrolled for the specified user.

Request Parameters:
1. PublishProfileRequest

Note:* UserName is Enrollment User Name

2. AWOperationContext

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

121
Chapter 5: Enrollment Service

Response Elements:

C# Sample Code (Console Application)

public static void PublishUserProfiles()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
EnrollmentServiceClient client = new EnrollmentServiceClient();
client.Open();
PublishProfileRequest profileRequest = new PublishProfileRequest()
{
ActivationCode = "adam", //Customer code of locationgroup
UserName = "winUser", //Enrollment User Name

ProfileType = ProfileTypes.LDAP
};

client.PublishUserProfiles(profileRequest, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

122
Chapter 5: Enrollment Service

Java Sample Code

public void publishUserProfiles()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/EnrollmentServiceEndp
oint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile = "D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";


InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile = "D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";


KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";


trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(keyStore,


keyStrorePassword.toCharArray(), trustStore); SSLContext sslClientContext =
sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

EnrollmentServiceEndpointStub stub = new EnrollmentServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

123
Chapter 5: Enrollment Service

try {
EnrollmentServiceEndpointStub.ServiceIdentity serviceIdentity = new
EnrollmentServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

EnrollmentServiceEndpointStub.AWOperationContext operationContext = new


EnrollmentServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

EnrollmentServiceEndpointStub.PublishProfileRequest publishProfileRequest
= new EnrollmentServiceEndpointStub.PublishProfileRequest();

publishProfileRequest.setActivationCode("adam");

publishProfileRequest.setUserName("demo");

publishProfileRequest
.setProfileType(EnrollmentServiceEndpointStub.ProfileTypes.LDAP);

EnrollmentServiceEndpointStub.PublishUserProfiles publishUserProfiles =
new EnrollmentServiceEndpointStub.PublishUserProfiles();

publishUserProfiles.setOperationContext(operationContext);
publishUserProfiles
.setProfileRequestTransport(publishProfileRequest);

stub.publishUserProfiles(publishUserProfiles);
}
catch (Exception ex) { Logger.getLogger(Main.class.getName()).log
(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

124
Chapter 5: Enrollment Service

LoadEnrolledDeviceUser
Loads the enrollment User for the specified device. If DeviceID is known then send only DeviceID. If device ID is unknown
then device type and DeviceUid should be sent.

Request Parameters:
1. DeviceEntity

2. AWOperationContext

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

125
Chapter 5: Enrollment Service

Response Elements:
EnrollmentUserEntity

C# Sample Code (Console Application)

public static void LoadEnrolledDeviceUser()


{
try
{
AWOperationContext context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
EnrollmentServiceClient client = new EnrollmentServiceClient();
client.Open();
var device = new DeviceEntity();
device.Id = new EntityKey(){ Value = 4242};
EnrollmentUserEntity enrollenUser = client.LoadEnrolledDeviceUser
(device, context);

client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

126
Chapter 5: Enrollment Service

Java Sample Code

public void loadEnrolledDeviceUser()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/EnrollmentServiceEndp
oint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory
(keyStore, keyStrorePassword.toCharArray(), trustStore); SSLContext
sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
EnrollmentServiceEndpointStub stub = new EnrollmentServiceEndpointStub();

stub._getServiceClient().getOptions().setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
EnrollmentServiceEndpointStub.ServiceIdentity serviceIdentity = new
EnrollmentServiceEndpointStub.ServiceIdentity();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

127
Chapter 5: Enrollment Service

serviceIdentity.setName("Administrator");

EnrollmentServiceEndpointStub.AWOperationContext operationContext =
new EnrollmentServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

EnrollmentServiceEndpointStub.DeviceEntity deviceEntity=new
EnrollmentServiceEndpointStub.DeviceEntity();

EnrollmentServiceEndpointStub.EntityKey entityKey=new
EnrollmentServiceEndpointStub.EntityKey();

entityKey.setValue(4242);
deviceEntity.setId(entityKey);

EnrollmentServiceEndpointStub.LoadEnrolledDeviceUser
loadEnrolledDeviceUser=new
EnrollmentServiceEndpointStub.LoadEnrolledDeviceUser();

loadEnrolledDeviceUser.setOperationContextTransport(operationContext);
loadEnrolledDeviceUser.setDeviceEntityTransport(deviceEntity);
stub.loadEnrolledDeviceUser(loadEnrolledDeviceUser);
}
catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

128
Chapter 6:
Location Group Service
Load 130
Save 134
139
Search 140
DeleteLocationGroup 144
DeleteUserInGroup 148
ProvisionLocationGroup 151
LoadGroupAuthenticationTypes 155
GetEnrollmentStatusForLg 158
161
LoadHierarchy 162

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

129
Chapter 6: Location Group Service

Load
This API loads the locationGroup based on the locationGroup ID.

Request Parameters:

Response Elements:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LocationGroup.LocationGroupService;
namespace LocationGroup
{
class Program
{
static void Main(string[] args)
{
try
{
// Create an instance of LocationGroupServiceClient
LocationGroupServiceClient client = new LocationGroupServiceClient
();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

130
Chapter 6: Location Group Service

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/
const string userName = "Administrator";
var operationContext = new AWOperationContext();

operationContext.Identity = new ServiceIdentity() { Name =


userName };

// Location Group ID
const int locationGroup = 7;

// Entity Key for Location Group ID


EntityKey locationGroupId = new EntityKey { Value = locationGroup
};
var locationGroupEntity = client.Load(locationGroupId,
operationContext);
if (!string.IsNullOrEmpty(locationGroupEntity.Name))
{
Console.WriteLine("Location Group is successfully loaded.
Press any key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Location Group load failed. Please try
again. Press any key to continue..");
Console.ReadLine();
}
}
catch
{
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

131
Chapter 6: Location Group Service

C# Sample Code

public void loadLocationGroup()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks"; InputStream
keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS"); keyInput = new


FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();

stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

132
Chapter 6: Location Group Service

LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new


LocationGroupServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationGroupServiceEndpointStub.EntityKey entityKey=new
LocationGroupServiceEndpointStub.EntityKey();

entityKey.setValue(7);

LocationGroupServiceEndpointStub.Load load=new
LocationGroupServiceEndpointStub.Load();

load.setOperationContext(operationContext);
load.setLocationGroupEntity(entityKey);

stub.load(load);
}
catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

133
Chapter 6: Location Group Service

Save
Creates the location group in the DB.

Request Parameters:
1. LocationGroupEntity

2. AWOperationContext

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

134
Chapter 6: Location Group Service

Response Elements:

C# Sample Code (Console Application)

public static void LocationgroupSave()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
var locationGroupEntity = new LocationGroupEntity();
locationGroupEntity.Name = "Lg_Name";
locationGroupEntity.LocationGroupType = new LocationGroupTypeListItem
{

// Set LocationGroupType
//This value should be present in 'LocationGroupType' table in DB
Id = new EntityKey {Value = (int) 1},
Text = "Test",
Value = "Test"
};
locationGroupEntity.ParentLocationGroupReference = new
ConcurrentEntityReference
{
// Assign parent LG ID Id = new EntityKey
{

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

135
Chapter 6: Location Group Service

Value = 7
},
ReferenceConcurrencyId = new ConcurrencyIdentifier(),ReferenceType =
"Test"
};
Guid();

locationGroupEntity.ParentLocationGroupReference.ReferenceConcurrency
Id.Value = new locationGroupEntity.ChildLocationGroupReferences = new
ConcurrentEntityReference[0];

locationGroupEntity.Country = new CountryListItem


{
// Assign Country ID, ID should be there in country table
Id = new EntityKey(){Value = 1}, Text = "",Value = ""
};
locationGroupEntity.CustomerCode = "LG_CustomerCode";

var client = new LocationGroupServiceClient();


client.Open();
var result = client.Save(locationGroupEntity, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void locationgroupSave()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

136
Chapter 6: Location Group Service

keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();
stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationGroupServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationGroupServiceEndpointStub.LocationGroupEntity
locationGroupEntity =new
LocationGroupServiceEndpointStub.LocationGroupEntity();

locationGroupEntity.setName("unique");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

137
Chapter 6: Location Group Service

LocationGroupServiceEndpointStub.LocationGroupTypeListItem
locationGroupTypeListItem=new
LocationGroupServiceEndpointStub.LocationGroupTypeListItem();

locationGroupTypeListItem.setText("test");

locationGroupTypeListItem.setValue("test");

LocationGroupServiceEndpointStub.EntityKey entityKey =new


LocationGroupServiceEndpointStub.EntityKey();

entityKey.setValue(1);

locationGroupTypeListItem.setId(entityKey);

locationGroupEntity.setLocationGroupType(locationGroupTypeListItem);

LocationGroupServiceEndpointStub.ConcurrentEntityReference
concurrentEntityReference=new
LocationGroupServiceEndpointStub.ConcurrentEntityReference();

LocationGroupServiceEndpointStub.EntityKey parentEntityKey =new


LocationGroupServiceEndpointStub.EntityKey();

parentEntityKey.setValue(7);

concurrentEntityReference.setId(parentEntityKey);

LocationGroupServiceEndpointStub.ConcurrencyIdentifier
concurrencyIdentifier=new
LocationGroupServiceEndpointStub.ConcurrencyIdentifier();

LocationGroupServiceEndpointStub.Guid guid= new


LocationGroupServiceEndpointStub.Guid();

guid.setGuid(UUID.randomUUID().toString());

concurrencyIdentifier.setValue(guid);

concurrentEntityReference.setReferenceConcurrencyId
(concurrencyIdentifier); concurrentEntityReference.setReferenceType
("Test");

locationGroupEntity.setParentLocationGroupReference
(concurrentEntityReference);

LocationGroupServiceEndpointStub.ArrayOfConcurrentEntityReference
arrayOfConcurrentEntityReference=new
LocationGroupServiceEndpointStub.ArrayOfConcurrentEntityReference();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

138
Chapter 6: Location Group Service

locationGroupEntity.setChildLocationGroupReferences
(arrayOfConcurrentEntityReference);

LocationGroupServiceEndpointStub.CountryListItem countryListItem=new
LocationGroupServiceEndpointStub.CountryListItem();

LocationGroupServiceEndpointStub.EntityKey countryEntityKey =new


LocationGroupServiceEndpointStub.EntityKey();

countryEntityKey.setValue(1);

countryListItem.setId(countryEntityKey);

countryListItem.setText("");

countryListItem.setValue("");

locationGroupEntity.setCountry(countryListItem);

locationGroupEntity.setCustomerCode("newcust2");

LocationGroupServiceEndpointStub.Save save=new
LocationGroupServiceEndpointStub.Save();

save.setLocationGroupEntity(locationGroupEntity);

save.setOperationContext(operationContext);

stub.save(save);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

139
Chapter 6: Location Group Service

Search
Search the Location Group based on the search criteria

Request Parameters:
1. LocationGroupSearchCriteria

2. AWOperationContext

Response Elements:
Array of LocationGroupSearchResult object.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

140
Chapter 6: Location Group Service

C# Sample Code (Console Application)

public static void LocationgroupSearch()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
var client = new LocationGroupServiceClient();
client.Open();
var groupSearchCriteria = new LocationGroupSearchCriteria();

groupSearchCriteria.RootLocationGroupKey = new EntityKey() {Value =


7};
groupSearchCriteria.CustomerCode = "LG_CustomerCode";

// Inclues all the heirarchy

groupSearchCriteria.IncludeSubTree = true;
var result = client.Search(groupSearchCriteria, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

141
Chapter 6: Location Group Service

Java Sample Code

public void locationgroupSearch() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks"; KeyStore trustStore
= KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory
(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

142
Chapter 6: Location Group Service

try {
LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationGroupServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);
LocationGroupServiceEndpointStub.LocationGroupSearchCriteria
locationGroupSearchCriteria = new
LocationGroupServiceEndpointStub.LocationGroupSearchCriteria();

LocationGroupServiceEndpointStub.EntityKey entityKey = new


LocationGroupServiceEndpointStub.EntityKey();

entityKey.setValue(7);
locationGroupSearchCriteria.setRootLocationGroupKey(entityKey);
locationGroupSearchCriteria.setCustomerCode("newcust11");
locationGroupSearchCriteria.setIncludeSubTree(true);

LocationGroupServiceEndpointStub.Search search = new


LocationGroupServiceEndpointStub.Search();

search.setSearchCriteria(locationGroupSearchCriteria);
search.setOperationContext(operationContext); stub.search(search);
}

catch (Exception ex)


{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

143
Chapter 6: Location Group Service

DeleteLocationGroup
API to delete the LocationGroup from the DB.

Request Parameters:
1. EntityKey

2. AWOperationContext

Response Elements:
Boolean value to indicate success/failure.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

144
Chapter 6: Location Group Service

C# Sample Code (Console Application)

public void DeleteLocationGroup()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
var client = new LocationGroupServiceClient();
client.Open();
var locationGroupID = new EntityKey() {Value = 1401};

client.DeleteLocationGroup(locationGroupID, context); client.Close();


}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void deleteLocationGroup() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

145
Chapter 6: Location Group Service

String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationGroupServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");

LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationGroupServiceEndpointStub.EntityKey entityKey = new


LocationGroupServiceEndpointStub.EntityKey();

entityKey.setValue(3867);

LocationGroupServiceEndpointStub.DeleteLocationGroup
deleteLocationGroup = new
LocationGroupServiceEndpointStub.DeleteLocationGroup();

deleteLocationGroup.setLocationGroupEntity(entityKey);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

146
Chapter 6: Location Group Service

deleteLocationGroup.setOperationContext(operationContext);

stub.deleteLocationGroup(deleteLocationGroup);
}

catch (Exception ex) {


Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

147
Chapter 6: Location Group Service

DeleteUserInGroup
API to delete the Admin Users in the LocationGroup.

Request Parameters:
1. EntityKey

2. AWOperationContext

Response Elements:
Boolean value to indicate success/failure.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

148
Chapter 6: Location Group Service

C# Sample Code (Console Application)

public void DeleteUserInGroup ()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
var client = new LocationGroupServiceClient();
client.Open();
var locationGroupID = new EntityKey() {Value = 1401};
var success = client. DeleteUserInGroup (locationGroupID,
context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void deleteUserInGroup()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

149
Chapter 6: Location Group Service

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";


trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(


keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();

stub._getServiceClient().getOptions().setProperty(
org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient().getOptions().setProperty(
org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationGroupServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationGroupServiceEndpointStub.EntityKey entityKey = new


LocationGroupServiceEndpointStub.EntityKey();

entityKey.setValue(3867);
LocationGroupServiceEndpointStub.DeleteUserInGroup
deleteUserInGroup=new
LocationGroupServiceEndpointStub.DeleteUserInGroup();

deleteUserInGroup.setLocationGroup(entityKey);

deleteUserInGroup.setOperationContext(operationContext);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

150
Chapter 6: Location Group Service

stub.deleteUserInGroup(deleteUserInGroup);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

ProvisionLocationGroup
Does the provisioning related actions for LG like suspend/allow enrollment, lock/unlock users.

Request Parameters:
1. ProvisionGroupRequest

Response Elements:
No response

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

151
Chapter 6: Location Group Service

C# Sample Code (Console Application)

public void ProvisionLocationGroup()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
var client = new LocationGroupServiceClient();
client.Open();
var provisionRequest = new ProvisionGroupRequest();
provisionRequest.ActivationCode = "adam";

// Set device action


provisionRequest.DeviceAction = ProvisionGroupDeviceAction.None;

// set user action


provisionRequest.UserAction = ProvisionGroupUserAction.LockUsers;

client.ProvisionLocationGroup(provisionRequest, context);

client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void provisionLocationGroup()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);

KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

152
Chapter 6: Location Group Service

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();

stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {

LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new


LocationGroupServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

153
Chapter 6: Location Group Service

operationContext.setIdentity(serviceIdentity);

LocationGroupServiceEndpointStub.ProvisionGroupRequest
provisionGroupRequest=new
LocationGroupServiceEndpointStub.ProvisionGroupRequest();

provisionGroupRequest.setActivationCode("newcust11");

LocationGroupServiceEndpointStub.ProvisionGroupDeviceAction
provisionGroupDeviceAction=ProvisionGroupDeviceAction.None;

provisionGroupRequest.setDeviceAction(provisionGroupDeviceAction);

LocationGroupServiceEndpointStub.ProvisionGroupUserAction
provisionGroupUserAction=ProvisionGroupUserAction.LockUsers;

provisionGroupRequest.setUserAction(provisionGroupUserAction);

LocationGroupServiceEndpointStub.ProvisionLocationGroup
provisionLocationGroup=new
LocationGroupServiceEndpointStub.ProvisionLocationGroup();

provisionLocationGroup.setOperationContext(operationContext);

provisionLocationGroup.setLocationGroupProvision
(provisionGroupRequest);

stub.provisionLocationGroup(provisionLocationGroup);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

154
Chapter 6: Location Group Service

LoadGroupAuthenticationTypes
This is an API to get the enrollment authentication type list configured for a location group. Location Group is based on
customer code.

Request Parameters:
1. LocationgroupEntity with customer code.

2. AWOperationContext

Response Elements:
Returns an array of EnrollmentUserAuthenticationType

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

155
Chapter 6: Location Group Service

C# Sample Code (Console Application)

public void LoadGroupAuthenticationTypes()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};

var client = new LocationGroupServiceClient();


client.Open();
var locationGroup = new LocationGroupEntity();
locationGroup.CustomerCode = "adam";
var enrollmentUserAuthenticationTypes =
client.LoadGroupAuthenticationTypes(locationGroup,context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void loadGroupAuthenticationTypes() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

156
Chapter 6: Location Group Service

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(


keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty( org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationGroupServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationGroupServiceEndpointStub.LocationGroupEntity
locationGroupEntity = new
LocationGroupServiceEndpointStub.LocationGroupEntity();

locationGroupEntity.setCustomerCode("newcust11");

LocationGroupServiceEndpointStub.LoadGroupAuthenticationTypes
loadGroupAuthenticationTypes = new
LocationGroupServiceEndpointStub.LoadGroupAuthenticationTypes();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

157
Chapter 6: Location Group Service

loadGroupAuthenticationTypes.setOperationContext(operationContext);

loadGroupAuthenticationTypes
.setLocationGroupEntity(locationGroupEntity);
}

catch (Exception ex) {


Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

GetEnrollmentStatusForLg
Gets the enrollment suspended status for the list of Location Groups.

Request Parameters:
1. Array of integer of locationGroup IDs for which enrollmentStatus is required. Int[]

2. AWOperationContext

Response Elements:
Array of Locationgroup Entity for all the LG IDs sent in input.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

158
Chapter 6: Location Group Service

C# Sample Code (Console Application)

public static void GetEnrollmentStatusForLg()


{
try
{
var context = new AWOperationContext()
{

Identity = new ServiceIdentity() { Name = "Administrator" }


};
var client = new LocationGroupServiceClient();
client.Open();

// Assign LG IDs
var locationGroupIds = new int[3];

locationGroupIds[0] = 7;

locationGroupIds[1] = 630;

locationGroupIds[2] = 631;

var locationGroupEntity = client.GetEnrollmentStatusForLg


(locationGroupIds, context);

foreach (var groupEntity in locationGroupEntity)


{
Console.Write(@"Enrollment Suspended status of LocationGroup "
groupEntity.Id.Value + @" is "
groupEntity.EnrollmentSuspendedStatus);
}
client.Close();
}
catch (Exception ex)
{
throw ex;
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

159
Chapter 6: Location Group Service

Java Sample Code

public void getEnrollmentStatusForLg() throws AxisFault, Exception

String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);
String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(


keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext,false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

160
Chapter 6: Location Group Service

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationGroupServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationGroupServiceEndpointStub.GetEnrollmentStatusForLg
getEnrollmentStatusForLg = new
LocationGroupServiceEndpointStub.GetEnrollmentStatusForLg();

ArrayOfint arrayOfint = new ArrayOfint();


int[] arrayint = new int[3];
arrayint[0] = 7;
arrayint[0] = 631;
arrayint[0] = 632;
arrayOfint.set_int(arrayint);

getEnrollmentStatusForLg.setLocationGroupIDs(arrayOfint);

getEnrollmentStatusForLg.setOperationContext(operationContext);

LocationGroupServiceEndpointStub.GetEnrollmentStatusForLgResponse
getEnrollmentStatusForLgResponse = stub.getEnrollmentStatusForLg
(getEnrollmentStatusForLg);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

161
Chapter 6: Location Group Service

LoadHierarchy
Loads a hierarchical listing of all instances defined for an AirWatch user. The name specified in the operation context is
considered as AirWatch user and it loads the LG hierarchy based on user’s LG.

Request Parameters:
1. AWOperationContext

Response Elements:

C# Sample Code (Console Application)

public static void LoadHierarchy()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
var client = new LocationGroupServiceClient();
client.Open();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

162
Chapter 6: Location Group Service

var result = client.LoadHierarchy( context);


client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

163
Chapter 6: Location Group Service

Java Sample Code

public void loadHierarchy()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationGroupServiceE
ndpoint.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationGroupServiceEndpointStub stub = new


LocationGroupServiceEndpointStub();

stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient().getOptions().setProperty
(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_
HANDLER,myProtocolHandler);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

164
Chapter 6: Location Group Service

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {

LocationGroupServiceEndpointStub.ServiceIdentity serviceIdentity = new


LocationGroupServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationGroupServiceEndpointStub.AWOperationContext operationContext =
new LocationGroupServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationGroupServiceEndpointStub.LoadHierarchy loadHierarchy=new
LocationGroupServiceEndpointStub.LoadHierarchy();

loadHierarchy.setOperationContext(operationContext);

stub.loadHierarchy(loadHierarchy);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

165
Chapter 7:
Location Services
Load 167
Save 170
Search 176
List 180

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

166
Chapter 7: Location Services

Load
Loads the entire location Entity based on the LocationID.

Request Parameters:
1. LocationID

2. AWOperationContext

Response Elements:
LocationEntity

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

167
Chapter 7: Location Services

C# Sample Code (Console Application)

public static void LocationLoad()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity () {Name = "Administrator" }
};
var locationID = new EntityKey() {Value = 4586}; var client = new
LocationServiceClient();
client.Open();
var locationEntity = client.Load(locationID, context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void locationLoad() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationServiceEndpoi
nt.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile="D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword="wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String
trustStoreFile="D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

168
Chapter 7: Location Services

String trustStorePassword="changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationServiceEndpointStub stub = new LocationServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {

LocationServiceEndpointStub.ServiceIdentity serviceIdentity = new


LocationServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationServiceEndpointStub.AWOperationContext operationContext = new


LocationServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationServiceEndpointStub.EntityKey entityKey = new


LocationServiceEndpointStub.EntityKey();

entityKey.setValue(4586);

LocationServiceEndpointStub.Load load = new


LocationServiceEndpointStub.Load();

load.setEntityKey(entityKey); load.setOperationContext
(operationContext);
stub.load(load);
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

169
Chapter 7: Location Services

catch (Exception ex)


{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

Save
Creates a location in the database with the specified values.

Request Parameters:
1. LocationEntity

2. AWOperationContext

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

170
Chapter 7: Location Services

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Location.LocationService;
namespace Location
{
class Program
{
static void Main(string[] args)
{
try
{
// Create an instance of LocationGroupServiceClient.

LocationServiceClient client = new LocationServiceClient();

/* An instance of AWOperationContext holds the current user


context. For testing the API, we can generalize the user as
Administrator.*/

const string userName = "Administrator";


var operationContext = new AWOperationContext();
operationContext.Identity = new ServiceIdentity() { Name =
userName };

// Location Group ID
const int locationGroup = 7;

// An instance of LocationEntity holds the data to be saved.


var locationEntity = new LocationEntity()
{
ConcurrencyId = new ConcurrencyIdentifier() { Value = new Guid()
}, ParentLocationGroupReference = new ConcurrentEntityReference()
{
Id = new EntityKey{Value = locationGroup},ReferenceConcurrencyId =
new ConcurrencyIdentifier() { Value = new Guid() }
},

// Get these from the Pick List Service


LocationType = new LocationTypeListItem() { Id = new EntityKey
{Value = 3}}, Status = new LocationStatusListItem() { Id = new
EntityKey { Value = 10 } }, LocationCode = "5555",InternalName =
"Location Service"
};
LocationEntity savedLocationEntity = client.Save(locationEntity,
operationContext);

if (!string.IsNullOrEmpty(savedLocationEntity.InternalName))

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

171
Chapter 7: Location Services

{
Console.WriteLine("Location is successfully saved. Press any
key to continue..");
Console.ReadLine();
}
else
{
Console.WriteLine("Location save failed. Please try again.
Press any key to continue..");
Console.ReadLine();
}
}
catch (Exception)
{
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

172
Chapter 7: Location Services

Java Sample Code

public void locationSave()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationServiceEndpoi
nt.svc";
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());

keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");


keyInput = new FileInputStream(trustStoreFile);
String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory
(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
LocationServiceEndpointStub stub = new LocationServiceEndpointStub();
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER,myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

173
Chapter 7: Location Services

try {
LocationServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationServiceEndpointStub.AWOperationContext operationContext = new


LocationServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationServiceEndpointStub.LocationEntity locationEntity=new
LocationServiceEndpointStub.LocationEntity();

LocationServiceEndpointStub.ConcurrentEntityReference
concurrentEntityReference=new
LocationServiceEndpointStub.ConcurrentEntityReference();

LocationServiceEndpointStub.EntityKey locationEntityKey=new
LocationServiceEndpointStub.EntityKey();

locationEntityKey.setValue(7);

concurrentEntityReference.setId(locationEntityKey);

LocationServiceEndpointStub.ConcurrencyIdentifier
concurrencyIdentifier=new
LocationServiceEndpointStub.ConcurrencyIdentifier();

LocationServiceEndpointStub.Guid guid= new


LocationServiceEndpointStub.Guid();

guid.setGuid(UUID.randomUUID().toString());

concurrencyIdentifier.setValue(guid);

concurrentEntityReference.setReferenceConcurrencyId
(concurrencyIdentifier);
locationEntity.setParentLocationGroupReference
(concurrentEntityReference);

LocationServiceEndpointStub.LocationTypeListItem
locationTypeListItem=new
LocationServiceEndpointStub.LocationTypeListItem();

LocationServiceEndpointStub.EntityKey locationTypeEntityKey=new
LocationServiceEndpointStub.EntityKey();

locationTypeEntityKey.setValue(3);
locationTypeListItem.setId(locationTypeEntityKey);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

174
Chapter 7: Location Services

locationEntity.setLocationType(locationTypeListItem);

LocationServiceEndpointStub.LocationStatusListItem
locationStatusListItem=new
LocationServiceEndpointStub.LocationStatusListItem();

LocationServiceEndpointStub.EntityKey locationStatusEntityKey=new
LocationServiceEndpointStub.EntityKey();

locationStatusEntityKey.setValue(10);

locationStatusListItem.setId(locationStatusEntityKey);

locationEntity.setStatus(locationStatusListItem);

locationEntity.setLocationCode("6666");

locationEntity.setInternalName("Location Service");

LocationServiceEndpointStub.Save save=new
LocationServiceEndpointStub.Save();
save.setLocationEntity(locationEntity);
save.setOperationContext(operationContext);
LocationServiceEndpointStub.SaveResponse saveResponse=stub.save(save);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

175
Chapter 7: Location Services

Search
Searches the location based on the search criteria.

Request Parameters:
1. LocationSearchCriteria

2. AWOperationContext

Response Elements:
Array of LocationSearchResult:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

176
Chapter 7: Location Services

C# Sample Code (Console Application)

public static void Search()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
var client = new LocationServiceClient();
client.Open();
var locationSearchCriteria =new LocationSearchCriteria();
locationSearchCriteria.InternalName = "Internal - Unassigned";
locationSearchCriteria.StoreNumber = "100";

var result = client.Search(locationSearchCriteria, context);


client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

C# Sample Code (Console Application)

public void search() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationServiceEndpoi
nt.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile="D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword="wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String
trustStoreFile="D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

177
Chapter 7: Location Services

KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword="changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory(


keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationServiceEndpointStub stub = new LocationServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
LocationServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");

LocationServiceEndpointStub.AWOperationContext operationContext = new


LocationServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

LocationServiceEndpointStub.LocationSearchCriteria
locationSearchCriteria = new
LocationServiceEndpointStub.LocationSearchCriteria();

locationSearchCriteria.setInternalName("Location #1000");
locationSearchCriteria.setStoreNumber("1000");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

178
Chapter 7: Location Services

LocationServiceEndpointStub.Search search = new


LocationServiceEndpointStub.Search();

search.setOperationContext(operationContext)

search.setSearchCriteria(locationSearchCriteria);

stub.search(search);

}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

179
Chapter 7: Location Services

List
Returns the list of Location Entities under the location Group for which the admin User belongs to. The admin user name
is picked from the name of the call context.

Request Parameters:
1. AWOperationContext

Response Elements:
Array of LocationSearchResult:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

180
Chapter 7: Location Services

C# Sample Code (Console Application)

Public static void List Locations ()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "[email protected]"
}
};
var client = new LocationServiceClient();
client.Open();
var locationEntity = client.List( context);
client.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void listLocation()throws AxisFault, Exception


{
String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/LocationServiceEndpoi
nt.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

// End Point
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

181
Chapter 7: Location Services

KeyStore trustStore = KeyStore.getInstance("JKS"); keyInput = new


FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";


trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

LocationServiceEndpointStub stub = new LocationServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
LocationServiceEndpointStub.ServiceIdentity serviceIdentity = new
LocationServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
LocationServiceEndpointStub.AWOperationContext operationContext = new
LocationServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);

LocationServiceEndpointStub.EntityKey entityKey = new


LocationServiceEndpointStub.EntityKey();

entityKey.setValue(4586);

LocationServiceEndpointStub.List list = new


LocationServiceEndpointStub.List();

list.setOperationContext(operationContext);
stub.list(list);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

182
Chapter 7: Location Services

}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

183
Chapter 8:
Pick List Service
Overview 185
LoadLocationGroupTypeList 185
LoadLocationTypeList 189
LoadLocationStatusList 192
LoadAddressTypeList 194
LoadCountryList 197
LoadDeviceCategoryList 200
LoadOwnershipList 202

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

184
Chapter 8: Pick List Service

Overview
This service provides methods to load lists of elements like ownership types, device types, and country codes from the
application configuration. These are typically used as parameters to other service requests. UI based applications may
use these methods to populate drop-down menus.

LoadLocationGroupTypeList
Loads the locationgroup Types from DB

Request Parameters:
None

Response Elements:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

185
Chapter 8: Pick List Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Picklist.PicklistService;
namespace Picklist
{
class LoadPickLists
{
static void Main(string[] args)
{
try
{
// Create an instance of PicklistServiceClient
PicklistServiceClient client = new PicklistServiceClient();

// Fetch picklist data from PicklistServiceClient


var locationGrouplist = client.LoadLocationGroupTypeList();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

186
Chapter 8: Pick List Service

Java Sample Code

public void loadLocationGroupTypeList() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/PicklistServiceEndpoi
nt.svc";
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

PicklistServiceEndpointStub stub = new PicklistServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

187
Chapter 8: Pick List Service

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
PicklistServiceEndpointStub.LoadLocationGroupTypeList
loadLocationGroupTypeList = new
PicklistServiceEndpointStub.LoadLocationGroupTypeList();

PicklistServiceEndpointStub.LoadLocationGroupTypeListResponse
loadLocationGroupTypeListResponse = stub.loadLocationGroupTypeList
(loadLocationGroupTypeList);

}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

188
Chapter 8: Pick List Service

LoadLocationTypeList
Loads the location Types from DB

Request Parameters:
None

Response Elements:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Picklist.PicklistService;
namespace Picklist
{
class LoadPickLists
{
static void Main(string[] args)
{
try
{
// Create an instance of PicklistServiceClient
PicklistServiceClient client = new PicklistServiceClient();

// Fetch picklist data from PicklistServiceClient


var locationTypeList = client.LoadLocationTypeList();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

189
Chapter 8: Pick List Service

Java Sample Code

public void loadLocationTypeList() throws AxisFault, Exception { String


endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/PicklistServiceEndpoi
nt.svc";
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

PicklistServiceEndpointStub stub = new PicklistServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
PicklistServiceEndpointStub.LoadLocationTypeList

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

190
Chapter 8: Pick List Service

loadLocationTypeList = new
PicklistServiceEndpointStub.LoadLocationTypeList();

PicklistServiceEndpointStub.LoadLocationTypeListResponse
loadLocationTypeListResponse = stub.loadLocationTypeList
(loadLocationTypeList);

}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

191
Chapter 8: Pick List Service

LoadLocationStatusList
Loads the location status from DB

Request Parameters:
None

Response Elements:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Picklist.PicklistService;
namespace Picklist
{
class LoadPickLists
{
static void Main(string[] args)
{
try
{
// Create an instance of PicklistServiceClient
PicklistServiceClient client = new PicklistServiceClient();
var locationStatusList = client.LoadLocationStatusList();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

192
Chapter 8: Pick List Service

Java Sample Code

public void loadLocationStatusList() throws AxisFault, Exception { String


endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/PicklistServiceEndpoi
nt.svc";
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());

keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit";


trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

PicklistServiceEndpointStub stub = new PicklistServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

193
Chapter 8: Pick List Service

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
PicklistServiceEndpointStub.LoadLocationStatusList
loadLocationStatusList = new
PicklistServiceEndpointStub.LoadLocationStatusList();

PicklistServiceEndpointStub.LoadLocationStatusListResponse
loadLocationGroupTypeListResponse = stub.loadLocationStatusList
(loadLocationStatusList);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

LoadAddressTypeList
Loads the AddressTypes from DB

Request Parameters:
None

Response Elements:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Picklist.PicklistService;

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

194
Chapter 8: Pick List Service

namespace Picklist
{
class LoadPickLists
{
static void Main(string[] args)
{
try
{
// Create an instance of PicklistServiceClient
PicklistServiceClient client = new PicklistServiceClient();

// Fetch picklist data from PicklistServiceClient


var addressTypeList = client.LoadAddressTypeList();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

195
Chapter 8: Pick List Service

Java Sample Code

public void loadAddressTypeList() throws AxisFault, Exception { String


endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/PicklistServiceEndpoi
nt.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

PicklistServiceEndpointStub stub = new PicklistServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

196
Chapter 8: Pick List Service

PicklistServiceEndpointStub.LoadAddressTypeList loadAddressTypeList =
new PicklistServiceEndpointStub.LoadAddressTypeList();

PicklistServiceEndpointStub.LoadAddressTypeListResponse
loadAddressTypeListResponse = stub.loadAddressTypeList
(loadAddressTypeList);
}

catch (Exception ex)


{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

LoadCountryList
Loads all country details from DB

Request Parameters:
None

Response Elements:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

197
Chapter 8: Pick List Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Picklist.PicklistService;
namespace Picklist
{
class LoadPickLists
{
static void Main(string[] args)
{
try
{
// Create an instance of PicklistServiceClient
PicklistServiceClient client = new PicklistServiceClient();
var countryList = client.LoadCountryList();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code

public void loadCountryList() throws AxisFault, Exception { String


endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/PicklistServiceEndpoi
nt.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

198
Chapter 8: Pick List Service

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

PicklistServiceEndpointStub stub = new PicklistServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
PicklistServiceEndpointStub.LoadCountryList loadCountryList = new
PicklistServiceEndpointStub.LoadCountryList();

PicklistServiceEndpointStub.LoadCountryListResponse
loadCountryListResponse = stub.loadCountryList(loadCountryList);

}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

199
Chapter 8: Pick List Service

LoadDeviceCategoryList
Loads the device category from DB

Request Parameters:
None

Response Elements:

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Picklist.PicklistService;
namespace Picklist
{
class LoadPickLists
{
static void Main(string[] args)
{
try
{
// Create an instance of PicklistServiceClient
PicklistServiceClient client = new PicklistServiceClient();
var deviceCategoryList = client.LoadDeviceCategoryList();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

200
Chapter 8: Pick List Service

Java Sample Code

public void loadDeviceCategoryList() throws AxisFault, Exception { String


endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/PicklistServiceEndpoi
nt.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

PicklistServiceEndpointStub stub = new PicklistServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
PicklistServiceEndpointStub.LoadDeviceCategoryList
loadDeviceCategoryList = new
PicklistServiceEndpointStub.LoadDeviceCategoryList();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

201
Chapter 8: Pick List Service

PicklistServiceEndpointStub.LoadDeviceCategoryListResponse
loadDeviceCategoryListResponse = stub.loadDeviceCategoryList
(loadDeviceCategoryList);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

LoadOwnershipList
Loads all the ownerships available in DB

Request Parameters:
None

Response Elements:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

202
Chapter 8: Pick List Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Picklist.PicklistService;
namespace Picklist
{
class LoadPickLists
{
static void Main(string[] args)
{
try
{
}
// Create an instance of PicklistServiceClient
PicklistServiceClient client = new PicklistServiceClient();
var ownershipList = client.LoadOwnershipList();
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Java Sample Code

public void loadOwnershipList() throws AxisFault, Exception { String


endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/PicklistServiceEndpoi
nt.svc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

203
Chapter 8: Pick List Service

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS"); keyInput = new


FileInputStream(trustStoreFile); String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());

keyInput.close();
X509SSLContextFactory sslContextFactory = new X509SSLContextFactory
(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

PicklistServiceEndpointStub stub = new PicklistServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
PicklistServiceEndpointStub.LoadOwnershipList loadOwnershipList = new
PicklistServiceEndpointStub.LoadOwnershipList();

PicklistServiceEndpointStub.LoadOwnershipListResponse
loadCountryListResponse = stub.loadOwnershipList(loadOwnershipList);

}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

204
Chapter 9:
User Service
Load 206
Save 210
Search 212
List 216
AddUserToRole 218
CreateAdminUser 223
DeleteAdminUser 226
GetUsersInGroup 229
ResetAdminUser 234

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

205
Chapter 9: User Service

Load
This API loads the user Entity based on the User ID.

Request Parameters:
1. UserID

2. AWOperationContext

Response Elements:
1. UserEntity

C# Sample Code (Console Application)

public static void LoadUser()


{

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

206
Chapter 9: User Service

try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
UserService.UserServiceClient serviceClient = new UserServiceClient();
serviceClient.Open();
var userID = new EntityKey();
userID.Value = 4;
var userResult = serviceClient.Load(userID, context);
serviceClient.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

207
Chapter 9: User Service

C# Sample Code (Console Application)

public void loadUser() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/UserServiceEndpoint.s
vc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile); String trustStorePassword


= "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
UserServiceEndpointStub stub = new UserServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {

UserServiceEndpointStub.ServiceIdentity serviceIdentity = new


UserServiceEndpointStub.ServiceIdentity();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

208
Chapter 9: User Service

serviceIdentity.setName("Administrator");

UserServiceEndpointStub.AWOperationContext operationContext = new


UserServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

UserServiceEndpointStub.EntityKey entityKey = new


UserServiceEndpointStub.EntityKey();

entityKey.setValue(639);
UserServiceEndpointStub.Load load = new UserServiceEndpointStub.Load
();
load.setOperationContext(operationContext);
load.setEntityKey(entityKey);

UserServiceEndpointStub.LoadResponse loadResponse = stub.load(load);


}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

209
Chapter 9: User Service

Save
This API is used to update the information of any Core User. New users cannot be created using this API. For creating new
admin-user use CreateAdminUser API explained later.

Request Parameters:
1. UserEntity

2. AWOperationContext

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

210
Chapter 9: User Service

C# Sample Code (Console Application)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Users.UserService;
namespace Users
{
class UserService
{
static void Main(string[] args)
{
try
{
// Create an instance of UserServiceClient
UserServiceClient client = new UserServiceClient();

/* An instance of AWOperationContext holds the current user context.


For testing the API, we can generalize the user as Administrator.*/

const string userName = "Administrator";


AWOperationContext operationContext = new AWOperationContext {
Identity = new ServiceIdentity { Name = userName } };

// load an existing user entity: Specify a valid existing user


int existingUser = 214;
EntityKey userId = new EntityKey { Value = existingUser };
UserEntity userEntity = client.Load(userId, operationContext);

// update some fields


userEntity.PrimaryTelephone = "9464646655";
userEntity.SecondaryTelephone = "9623456545";

userEntity.MobileTelephone = "9343434343";
userEntity.Fax = "9676767676";
userEntity.EmailAddress = "[email protected]";

UserEntity userEntityResult = client.Save(userEntity,


operationContext);
if (!string.IsNullOrEmpty(userEntity.UserName) &&
userEntityResult.EmailAddress == "[email protected]")
{
Console.WriteLine("User service is successfully loaded. Press any
key to continue.."); Console.ReadLine();
}
else
{
Console.WriteLine("User service failed to laod. Please try
again.Press any key to continue..");
Console.ReadLine();
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

211
Chapter 9: User Service

}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

Search
Searches for the Core User based on the search criteria.

Request Parameters:
1. UserSearchCriteria

2. AWOperationContext

Response Elements:

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

212
Chapter 9: User Service

C# Sample Code (Console Application)

public static void SearchUser()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
UserService.UserServiceClient serviceClient = new
UserServiceClient();
serviceClient.Open();
UserSearchCriteria searchCriteria = new UserSearchCriteria();
searchCriteria.UserName = "Administrator";
var userResult = serviceClient.Search(searchCriteria, context);
serviceClient.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

213
Chapter 9: User Service

Java Sample Code

public void searchUser() throws AxisFault, Exception { String endPointURI =


"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/UserServiceEndpoint.s
vc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";


keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();
Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

UserServiceEndpointStub stub = new UserServiceEndpointStub();

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
UserServiceEndpointStub.ServiceIdentity serviceIdentity = new
UserServiceEndpointStub.ServiceIdentity();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

214
Chapter 9: User Service

serviceIdentity.setName("Administrator");
UserServiceEndpointStub.AWOperationContext operationContext = new
UserServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

serServiceEndpointStub.UserSearchCriteria userSearchCriteria = new


UserServiceEndpointStub.UserSearchCriteria();

userSearchCriteria.setUserName("Administrator");

UserServiceEndpointStub.Search search = new


UserServiceEndpointStub.Search();
search.setOperationContext(operationContext);
search.setSearchCriteria(userSearchCriteria);
UserServiceEndpointStub.SearchResponse searchResponse = stub.search
(search);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

215
Chapter 9: User Service

List
Lists all AirWatch user search results accessible to an AirWatch User in the API call context.

Request Parameters:
1. AWOperationContext

Response Elements:
Array of UserEntity objects.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

216
Chapter 9: User Service

C# Sample Code (Console Application)

public static void ListUser()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};

UserService.UserServiceClient serviceClient = new UserServiceClient();


serviceClient.Open();
UserSearchCriteria searchCriteria = new UserSearchCriteria();
searchCriteria.UserName = "Administrator";
var userResult = serviceClient.List(context);
serviceClient.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void listUser() throws AxisFault, Exception { String endPointURI =


"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/UserServiceEndpoint.s
vc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());

keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

217
Chapter 9: User Service

KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile);

String trustStorePassword = "changeit"; trustStore.load(keyInput,


trustStorePassword.toCharArray()); keyInput.close();

keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

UserServiceEndpointStub stub = new UserServiceEndpointStub(); stub._


getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
UserServiceEndpointStub.ServiceIdentity serviceIdentity = new
UserServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
UserServiceEndpointStub.AWOperationContext operationContext = new
UserServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);
UserServiceEndpointStub.List list = new UserServiceEndpointStub.List
();

list.setOperationContext(operationContext);

UserServiceEndpointStub.ListResponse listResponse = stub.list(list);


}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

AddUserToRole
Associates a user with a location group and role.
If IsPrimaryRole is set to true, it updates the coreUser’s locationgroup to the specified locationGroup.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

218
Chapter 9: User Service

Request Parameters:
1. LocationGroupID

2. Role ID

3. User ID

4. IsPrimaryRole

5. AWOperationContext

Response Elements:
No response

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

219
Chapter 9: User Service

C# Sample Code (Console Application)

public static void AddUserToRole()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() {Name = "Administrator"}
};
UserService.UserServiceClient serviceClient = new
UserServiceClient();
serviceClient.Open();
var locationGroupKey = new EntityKey() {Value = 2490};
var roleKey = new EntityKey() {Value = 92};
var userKey = new EntityKey() {Value = 3966};
serviceClient.AddUserToRole(locationGroupKey, roleKey, userKey,
true, context);
serviceClient.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void addUserToRole() throws AxisFault, Exception { String endPointURI


=
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/UserServiceEndpoint.s
vc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");
String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();
String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";

KeyStore trustStore = KeyStore.getInstance("JKS");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

220
Chapter 9: User Service

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";

trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

UserServiceEndpointStub stub = new UserServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
UserServiceEndpointStub.ServiceIdentity serviceIdentity = new
UserServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
UserServiceEndpointStub.AWOperationContext operationContext = new
UserServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

UserServiceEndpointStub.EntityKey locationEntityKey = new


UserServiceEndpointStub.EntityKey();
locationEntityKey.setValue(7);

UserServiceEndpointStub.EntityKey roleEntityKey = new


UserServiceEndpointStub.EntityKey();

roleEntityKey.setValue(92);

UserServiceEndpointStub.EntityKey userEntityKey = new


UserServiceEndpointStub.EntityKey();

userEntityKey.setValue(3966); UserServiceEndpointStub.AddUserToRole
addUserToRole = new UserServiceEndpointStub.AddUserToRole();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

221
Chapter 9: User Service

addUserToRole.setOperationContext(operationContext);

addUserToRole.setLocationGroupKey(locationEntityKey);

addUserToRole.setRoleKey(roleEntityKey); addUserToRole.setUserKey
(userEntityKey);

stub.addUserToRole(addUserToRole);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

222
Chapter 9: User Service

CreateAdminUser
This method creates an admin user in the specified Location group. The User name should be unique and creating
duplicate user names are not allowed.

Request Parameters:

Response Elements:
After successful creation of admin user, CoreUserID is updated to the object and returned.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

223
Chapter 9: User Service

C# Sample Code (Console Application)

//
private void CreateAdminUser(AWTrialRequest awTrialRequest, int
locationGroupId)
{
var userEntity = new UserEntity
{
UserName = “Examplename”,
Company = “CompanyXYZ”,
EmailAddress = “[email protected]”,
FirstName = “John”,
LocationGroupReference = new ConcurrentEntityReference
{
Id = locationGroupId }
EntityKey { Value = locationGroupId
},
Password = CryptUtil.CreateRandomToken(6),
MobileTelephone = “8095504334”,
TimeZoneId = 1, CultureId = 1,
ContactType = 1,
};
var operationContext = new AWOperationContext
{
Identity = new ServiceIdentity { Name = "Administrator" }
};
var userServiceClient = new UserServiceClient();
userServiceClient.CreateAdminUser(userEntity, operationContext);
}

Java Sample Code

public void CreateAdminUser() throws AxisFault, Exception {


String endPointURI =
https://qa10ssl.AirWatchportals.com/AWBasicHttpService/UserServiceEndpoint.sv
c";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile);


String keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

224
Chapter 9: User Service

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile); String trustStorePassword


= "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);
SSLContext sslClientContext = sslContextFactory.buildSSLContext();

Protocol myProtocolHandler = new Protocol("https", new


SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
UserServiceEndpointStub stub = new UserServiceEndpointStub(); stub._
getServiceClient()
.getOptions()
.setPropert(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);

stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
UserServiceEndpointStub.ServiceIdentity serviceIdentity = new
UserServiceEndpointStub.ServiceIdentity();
serviceIdentity.setName("Administrator");
UserServiceEndpointStub.AWOperationContext operationContext = new
UserServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);

UserServiceEndpointStub.UserEntity userEntity = new


UserServiceEndpointStub.UserEntity();

userEntity.setUserName("testexample"); userEntity.setCompany
("CompanyXYZ"); userEntity.setEmailAddress("[email protected]");
userEntity.setFirstName("Jhon"); userEntity.setPassword
("password"); userEntity.setMobileTelephone("8095504334");
userEntity.setTimeZoneId(1); userEntity.setContactType(1);
userEntity.setCultureId(1);
UserServiceEndpointStub.ConcurrentEntityReference
concurrentEntityReference = new
UserServiceEndpointStub.ConcurrentEntityReference();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

225
Chapter 9: User Service

UserServiceEndpointStub.EntityKey entityKey = new


UserServiceEndpointStub.EntityKey();
entityKey.setValue(7); concurrentEntityReference.setId(entityKey);
userEntity.setLocationGroupReference(concurrentEntityReference);

UserServiceEndpointStub.CreateAdminUser createAdminUser = new


UserServiceEndpointStub.CreateAdminUser();
createAdminUser.setOperationContext(operationContext);
createAdminUser.setUserEntity(userEntity);
stub.createAdminUser(createAdminUser);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

Note:
l ConsoleMenuLayoutIsOverLay : False: Classic , True: Overlay

l Password should be sent to server.

l DefaultLandingPage, ContactType, and UserRoleID: Default value will be used if not data is set.

l LocationGroupReference should not be empty.

l UserName should be unique.

DeleteAdminUser
Deletes the Admin User from the database. Admin User can be deleted using username.

Request Parameters:
1. UserEntity

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

226
Chapter 9: User Service

2. AWOperationContext

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

227
Chapter 9: User Service

C# Sample Code (Console Application)

public static void DeleteAdminUser()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
UserService.UserServiceClient serviceClient = new UserServiceClient();
serviceClient.Open();
var user = new UserEntity();
user.UserName = "[email protected]";
var userResult = serviceClient.DeleteAdminUser(user, context);
serviceClient.Close();
}
catch (Exception ex)
{
throw ex;
}
}

Java Sample Code

public void deleteAdminUser() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/UserServiceEndpoint.s
vc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile); String


keyStrorePassword = "wif1Admin"; keyStore.load(keyInput,
keyStrorePassword.toCharArray()); keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks"; KeyStore trustStore
= KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile); String trustStorePassword


= "changeit"; trustStore.load(keyInput, trustStorePassword.toCharArray
()); keyInput.close();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

228
Chapter 9: User Service

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore); SSLContext
sslClientContext = sslContextFactory.buildSSLContext(); Protocol
myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
UserServiceEndpointStub stub = new UserServiceEndpointStub(); stub._
getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
UserServiceEndpointStub.ServiceIdentity serviceIdentity = new
UserServiceEndpointStub.ServiceIdentity();

serviceIdentity.setName("Administrator");
UserServiceEndpointStub.AWOperationContext operationContext = new
UserServiceEndpointStub.AWOperationContext();
operationContext.setIdentity(serviceIdentity);
UserServiceEndpointStub.UserEntity userEntity = new
UserServiceEndpointStub.UserEntity();

userEntity.setUserName("testexample");
UserServiceEndpointStub.DeleteAdminUser deleteAdminUser = new
UserServiceEndpointStub.DeleteAdminUser();
deleteAdminUser.setOperationContext(operationContext);
deleteAdminUser.setUserEntity(userEntity); stub.deleteAdminUser
(deleteAdminUser);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

GetUsersInGroup
Gets all the admin users in the specified LocationGroup ID.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

229
Chapter 9: User Service

Request Parameters:
1. LocationgroupID

2. AWOperationContext

Response Elements:
Array of User-Entity object.

C# Sample Code (Console Application)

public static void GetUsersInGroup()


{
try

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

230
Chapter 9: User Service

{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};
UserService.UserServiceClient serviceClient = new UserServiceClient();
serviceClient.Open();
var locationGroupKey = new EntityKey();
locationGroupKey.Value = 659;
var userResult = serviceClient.GetUsersInGroup(locationGroupKey,
context);
serviceClient.Close();
}
catch (Exception ex)
{
throw ex;
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

231
Chapter 9: User Service

Java Sample Code

public void getUsersInGroup() throws AxisFault, Exception {


String endPointURI =
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/UserServiceEndpoint.s
vc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";

InputStream keyInput = new FileInputStream(keyStoreFile); String


keyStrorePassword = "wif1Admin";
keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

keyInput = new FileInputStream(trustStoreFile); String trustStorePassword


= "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();


Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);

UserServiceEndpointStub stub = new UserServiceEndpointStub();


stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);
try {
UserServiceEndpointStub.ServiceIdentity serviceIdentity = new
UserServiceEndpointStub.ServiceIdentity();

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

232
Chapter 9: User Service

serviceIdentity.setName("Administrator");
UserServiceEndpointStub.AWOperationContext operationContext = new
UserServiceEndpointStub.AWOperationContext();

operationContext.setIdentity(serviceIdentity);
UserServiceEndpointStub.EntityKey entityKey = new
UserServiceEndpointStub.EntityKey();

entityKey.setValue(639);
UserServiceEndpointStub.GetUsersInGroup getUsersInGroup = new
UserServiceEndpointStub.GetUsersInGroup();
getUsersInGroup.setOperationContext(operationContext);
getUsersInGroup.setUserEntity(entityKey);
UserServiceEndpointStub.GetUsersInGroupResponse
getUsersInGroupResponse = stub
.getUsersInGroup(getUsersInGroup);
}
catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

233
Chapter 9: User Service

ResetAdminUser
This API resets password and unlock the Admin user.

Request Parameters:
1. User Entity

2. AWOperationContext

Response Elements:
No response.

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

234
Chapter 9: User Service

C# Sample Code (Console Application)

public static void ResetAdminUser()


{
try
{
var context = new AWOperationContext()
{
Identity = new ServiceIdentity() { Name = "Administrator" }
};

UserService.UserServiceClient serviceClient = new UserServiceClient();


serviceClient.Open();
var userID = new EntityKey();
userID.Value = 2168;
serviceClient.ResetAdminUser(new UserEntity(), context);
serviceClient.Close();
}
catch (Exception ex)
{
throw ex;
}
}

C# Sample Code (Console Application)

public void resetAdminUser() throws AxisFault, Exception { String endPointURI


=
"https://qa10ssl.AirWatchportals.com/AWBasicHttpService/UserServiceEndpoint.s
vc";

System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
EndpointReference targetEndPoint = new EndpointReference(endPointURI);
KeyStore keyStore = KeyStore.getInstance("JKS");

String keyStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\client.jks";
InputStream keyInput = new FileInputStream(keyStoreFile);

String keyStrorePassword = "wif1Admin";

keyStore.load(keyInput, keyStrorePassword.toCharArray());
keyInput.close();

String trustStoreFile =
"D:\\AirWatch\\project\\ClientTest\\ssl\\server.jks";
KeyStore trustStore = KeyStore.getInstance("JKS");

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

235
Chapter 9: User Service

keyInput = new FileInputStream(trustStoreFile);


String trustStorePassword = "changeit";
trustStore.load(keyInput, trustStorePassword.toCharArray());
keyInput.close();

X509SSLContextFactory sslContextFactory = new X509SSLContextFactory


(keyStore, keyStrorePassword.toCharArray(), trustStore);

SSLContext sslClientContext = sslContextFactory.buildSSLContext();


Protocol myProtocolHandler = new Protocol("https", new
SslContextedSecureProtocolSocketFactory(sslClientContext, false), 443);
UserServiceEndpointStub stub = new UserServiceEndpointStub(); stub._
getServiceClient()
.getOptions()
.setPropert(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setTo(targetEndPoint);
stub._getServiceClient()
.getOptions()
.setPropert(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_
PROTOCOL_HANDLER, myProtocolHandler);

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(120000);

try {
UserServiceEndpointStub.ServiceIdentity serviceIdentity = new
UserServiceEndpointStub.ServiceIdentity(); serviceIdentity.setName
("Administrator"); UserServiceEndpointStub.AWOperationContext
operationContext = new UserServiceEndpointStub.AWOperationContext
();
operationContext.setIdentity(serviceIdentity);
UserServiceEndpointStub.EntityKey entityKey = new
UserServiceEndpointStub.EntityKey();
entityKey.setValue(3988);
UserServiceEndpointStub.UserEntity userEntity = new
UserServiceEndpointStub.UserEntity();
userEntity.setId(entityKey);
UserServiceEndpointStub.ResetAdminUser resetAdminUser = new
UserServiceEndpointStub.ResetAdminUser();
resetAdminUser.setOperationContext(operationContext);
resetAdminUser.setUserEntity(userEntity); stub.resetAdminUser
(resetAdminUser);
}
catch (Exception ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
ex);
}
}

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

236
Chapter 10: Tables A: Catalog of Services

Chapter 10:
Tables A: Catalog of Services
Device Data Service
Service Method Type Description
Device Data Service LoadDeviceGpsDataForDateRange Query Loads recent GPS coordinates within the
given date range
LoadDeviceGpsDataForTimePeriod Query Loads recent GPS coordinates for the last
n days
LoadDeviceApplicationList Query Loads the applications for the device
LoadProvisioningProfiles Query Loads the provisioning profiles for a
device
LoadConfigurationProfiles Query Loads the configuration profiles for a
device
LoadDeviceMetricDetails Query Returns the Device and Device-Network
status details
LoadAdaptersByDevice Query Returns the network status details of the
device
ListCertificates Query Returns the certificates for a device
GetSecurityAuditDetails Query Returns the Security Audit information
for a device

Device Profile Services


Service Method Type Description
Device Profile InstallDeviceProfile Update Installs DevcieProfile on the device
Services
RemoveDeviceProfile Delete Removes the installed profiles on the
device
CopyProfileToLocationGroup Update Copies the specified profile from one LG
to another LG
GetDeviceProfileByID Query Returns the complete DeviceProfile Entity

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

237
Chapter 10: Tables A: Catalog of Services

Device Service
Service Method Type Description
Device Service Save Update Persists a Device
Load Query Loads a Device Record
Search Query Returns a Device matching a search
criteria
UpdateDevice Update Updates Device Information for a given
device
List Query Returns a list of all devices accessible to a
User
LockDevice Device Locks an enrolled Device remotely
Command
ClearPasscode Device Clears the passcode for an enrolled
Command Device
DeviceWipe Device Wipes an enrolled Device
Command
UnenrollDevice Device Unenrolls an enrolled Device
Command
SendMessage Device Sends text message to an enrolled
Command Device
GetDevicesByLocationGroup Query Gets all the devices in the specified
LocationGroupID
QueryDevice Query Queries the device
RemoveDevice Query Removes the specified device from DB
GetDevicesByIsCompromised Query Returns a device count for a location
group for various compromised status
GetDeviceSummaryByPasscode Query Returns a device count for a location
group for various passcode
GetDeviceSummaryByDataEncryption Query Returns a device count for a location
group for various data encryption
GetDeviceSummaryByOwnership Query Returns a device count for a location
group for various ownerships
GetDeviceSummaryByPlatform Query Returns a device count for a location
group for various platforms

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

238
Chapter 10: Tables A: Catalog of Services

Enrollment Service
Service Method Type Description
Enrollment Service RegisterEnrollmentUser Create Creates a new enrollment user
RegisterDeviceForUser Update Associates a device with an enrollment
user
RemoveEnrollmentUser Update Deletes the enrollment User
PublishUserProfiles Update Publishes profile for devices enrolled for
the user
LoadEnrolledDeviceUser Query Loads the user for device

Location Group Service


Service Method Type Description
Location Group Load Query Loads a location group entity for the
Service specified location group
Save Update Persists a Location Group Entity
Search Query Searches for a Location group matching
the criteria
DeleteLocationGroup Delete Deletes the LG from the DB
DeleteUserInGroup Delete Deletes all the admin users from the LG
ProvisionLocationGroup Update Does the provisioning related actions for
LG like suspend/allow enrollment,
lock/unlock users
LoadGroupAuthenticationTypes Query Returns the enrollment authentication
type list configured for a location group
GetEnrollmentStatusForLg Query Returns the enrollment status for the list
of LG
LoadHierarchy Query Loads a hierarchical listing of all location
groups defined for an AirWatch user

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

239
Chapter 10: Tables A: Catalog of Services

Location Service
Service Method Type Description
Location Service Load Query Loads a location entity for the specified
identifier
Save Update Saves the specified Location entity.
Returns the updated entity
Search Query Gets a list of location search results based
on the specified location search criteria
List Query Return a list of all Location Entities

Pick List Service


Service Method Type Description
Pick List Service LoadLocationGroupTypeList Query Loads all known Location group types for
an AirWatch application
LoadLocationTypeList Query Loads all known Location types for an
AirWatch application
LoadLocationStatusList Query Loads all Possible Location Statuses
LoadAddressTypeList Query Loads all recognized address types. i.e.
Physical, Billing, Shipping etc.
LoadCountryList Query Returns all defined Countries with their
country code
LoadDeviceCategoryList Query Returns all defined Device Categories like
Generic,Vehicle Mount or Smartphone
LoadOwnershipList Query Returns Ownership Types like Corporate,
Employee or Shared

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

240
Chapter 10: Tables A: Catalog of Services

User Service
Service Method Type Description
User Service Load Query Loads a User from the Database
Save Update Persists a User
Search Query Finds one or more users matching a
search criteria
List Query Loads all Users list
ListRoles Query Lists all Security Roles for a given user
AddUserToRole Update Associates a user with a location group
and role
RemoveUserFromRole Update Removes a User's association to a Role at
a Location Group
CreateAdminUser Update Creates an Admin user in the specified
Location group
DeleteAdminUser Delete Deletes the admin user form DB
GetUsersInGroup Query Gets all the admin user in specified
location group
ResetAdminUser Update Resets the password and unlock the
useradmin

VMware AirWatch SOAP API Guide | v.2017.04 | April 2017


Copyright © 2017 VMware, Inc. All rights reserved. Proprietary & Confidential.

241

You might also like