What about having some example and explanation around webservices ? well it’s here :). The below article is explaining some history and convention we will use to leverage webservices in a series of articles.

XDM Revision 8.7

Index
  1. Little History
  2. What use for WS ?
  3. Between us.
  4. Pre-requisites to leverage samples and small projects we’ll go through together
  5. Our first sample for beginner : GetAllDevices
  6. Mr Geek Explanations

1. Little history

Webservices has been part of the product for a WHILE, I leveraged it for 5 years or so. EveryWAN Mobility Manager made by Sparus software had it, then Zenprise Device Manager (Zenprise acquired SPARUS on 2011) keeps it, then Citrix acquired Zenprise, still we can leverage it. Webservices most of the time made the difference and among some great differentiator keep me safe and ease day to day job. Indeed 5 years ago I was a fleet manager for the main Electricity provider in France. Why would web services help ? I needed reports and alerts on fleet’s health and also needed to report Weekly/monthly to management regarding the fleet stats, evolution…

2. What use for Webservice ?

You can go really far with webservices, most common use I see are: get/set user/device information, in order to make specific reports and/or detect anomaly such as unappropriate device state. You can also add properties to devices or custom attribute to users in order to represent customer environment, for example we can have a property called “Device_Store”, this in order to know which store the device belongs to and deploys specific policy from the webconsole depending on this property. We are also able to send notifications (SMS/Mail/System), or even to gather and send OneTimePassword invitations.

3. Between us

I will make the documentation as simple as possible, nevertheless sometime topics might need all your attention and can lead to some headaches so if you see the below PIC in front of a topic, you want to take a break and or a tea before starting the section.

Now since I can’t find my way to present code in a right manner in wordPress. Here is how we’ll operate :

1) I will put a screenshot of the code with pointers if necessary, to explain what you need to understand

2) put a link to the code for you to quickly grab it.

Mr Geek (Our Friend bellow) will “talks” a bit about Xenmobile functions we are leveraging, so when you see him in the top of a paragraph it means we are speaking of some WebServices’ methods.

4. Pre-requisites to leverage samples and small project we’ll go through together

I am a big fan of PhP, so all the below examples we’ll be based on this language.

You can use PhP either on Linux, Windows, MacOsX … You can use PhP as a command line client or as an Apache CGI.

You’ll also need a block note, on Windows I use notepad++, on mac textMate is great, as for Linux I do use emacs (yes I don’t have a UI and don’t need one).

    a. My way of installing PhP (command line) on Windows :

Command line is enough to start with because it let use webservices without an HTTP Server overhead so here is what I do :

1)   We will download php VC11 compiled with visual studio, therefore needing :

           The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64installed.

2)   Download php for Windows : http://windows.php.net/download/

Current version when writing this doc : http://windows.php.net/downloads/releases/php-5.5.12-nts-Win32-VC11-x86.zip

3)   Install VC++ redistributable, then PhP

   b. Official ways to install PhP :

For MaxOsX : http://www.php.net/manual/en/install.macosx.php
For Windows : http://www.php.net/manual/en/install.windows.php
For Linux : http://www.php.net/manual/en/install.unix.php

   c. PhP SOAPClient :

With windows it comes with the provided version, you just need to uncomment . look for a file named :  Php.ini or php.ini-development

1)     Seek for the below line :

    ;extension=php_soap.dll

2)     Remove the comma:
    extension=php_soap.dll

3)     Save this file as php.ini-development and close your file.

5. Our first sample for beginner : ShowAllDevices

We must start somewhere right, so the first thing will be doing is to create a really simple project. That gather all users.

1)   Create a folder named ShowAllDevices

2)   Copy php.ini-development in it.

3)   Download the file : ShowAllDevices.zip

4)   Modify the 4 first lines to put server informations

5)  Execute the script from command line :

php -c php.ini-development -f ShowAllDevices.php

6)      If you get the below error : follow step in above section “PhP SOAPClient

6. Mr Geek explanations

1. First we initialize SoapClient, important parameter being ‘location’

it indicates which endpoint to look for :)…

1.a try on your Xenmobile Device Manager to go to : http://yourmdmserver/zdm/services it will lists all availables endpoints.

1.b now if you try to go to http://yourmdmserver/zdm/services/EveryWanActivity?wdsl, not wdsl not wsdl IMPORTANT, if it returns the below error the you need to follow page 4 of the following document : here

1.c If no error then you’ll see a page like the below it’s ok you have webservices activated :

2. we leverage getAllDevices which returns an array with entries corresponding to IMEI, SerialNumber, StrongID.

2.a IMEI : International Mobile Equipment Identity

2.b SerialNumber : The Serial Number (experience speaking, it often isn’t right at least for Android, and it’s not depending on our solution.)

2.c StrongID : stands for Strong Identifier historical mathematic that was a kind of OTP for Windows Mobile ask John PIGERET if you want to know more when you face windows mobile