PowerShell & BlackBerry Web Services (Part 3 – Pseudocode)

In Part 1 of this series, we created a few files that are necessary to use the BlackBerry Web Services extensions.  In Part 2, I showed you how to load them into PowerShell.  Here in Part 3, we’ll be converting the C# sample code published by Research In Motion to PowerShell.

A note about SSL:

The BlackBerry Web Services rely on SSL communications so that the SOAP Requests & Responses are secure end-to-end.  Most people use Self-Signed certificates for the BlackBerry Administration Service web pages, so there are only a few options.  The most popular is to download the import the certificate into your trusted certificate authorities (I don’t care for this one).  As a second option, you can just tell PowerShell to not worry about the invalid certificate.  This second approach comes to us from the PowerShell Code Repository. (Link)

As I always try to do, we’ll start with the pseudocode.  I’m taking this directly from the BlackBerry Web Services Getting Started Guide.

  1. Create an SSL Ignore policy for this script.
  2. Import the Type Definition from the BlackBerry Web Services.
  3. Define some variables that we’ll need for connecting.
  4. Create a metadata object that we’ll use for initialization & populate it.
  5. Create & populate a BWS and a BWSUtil Service connection.
  6. Get an authenticator object.
  7. Create an “encoded” BlackBerry login username.
  8. Connect to the service using the encoded username, password (from variable), and authenticator object.
  9. Create a user search request.
  10. Send the search request and get a response.
  11. Enumerate the response if successful.

The above pseudocode is a good framework and steps 1 – 7 can pretty much be repeated over and over for whatever you want to do within the BlackBerry Web Services.  They can even be wrapped up into a nice little set of functions that you use whenever you need to connect.

Keep yourself tuned for Part 4 – Coding which will show each step of the pseudocode broken down into PowerShell.  It should be online shortly!

3 thoughts on “PowerShell & BlackBerry Web Services (Part 3 – Pseudocode)

Leave a Comment