Pages Menu
TwitterRssFacebook

Posted by on Mar 25, 2015 in Skype for Business® (Lync®)

UCWA Prerequisites: Before You Start

UCWA Prerequisites: Before You Start

UCWA is the Unified Communications Web API, and is Microsoft’s latest Lync tool for developers to build Lync-enabled applications. It’s the lightest-touch API there is: if you can send and receive HTTP traffic then you can make use of these APIs. For most of us though, the most likely application is in webpages – running JavaScript. For that reason, Microsoft have also made available some helper JavaScript libraries which simplify the process of writing UCWA applications.

One of the nice things about UCWA is that because it has so little dependencies the list of prerequisites is not large. However, there are some things you need, and some you’ll want.

On the Server

Firstly, your Lync environment will need an Edge Server, for your code to connect to. This will need to have an externally facing URL. A good test is whether or not you can sign into Lync using the Lync client from outside your network without needing to join a VPN or make any manual configuration changes.

You (or your Lync admin) needs to upgrade to at least Lync Server 2013 CU1, and run the bootstrapper on every Front End, Edge and Director server. To do this, run: %ProgramFiles%\Microsoft Lync Server 2013\Deployment\Bootstrapper.exe on each server.

For security you can’t just write code and point it at your Lync Server. This would mean anyone could set up a UCWA site to try and guess passwords remotely etc. Instead you have to register every domain where you’re going to be using UCWA with the Lync Server. You do this in PowerShell, using Get-CsWebServiceConfiguration and Set-CsWebServiceConfiguration.

Note: you need to do this on every FE, Edge and Director server.

First, run Get-CsWebServiceConfiguration to find the identities you have. If you only have one, make a note of it. If you have more than one, pick one and make a note of it.

To add a new domain for UCWA, create the domain using New-CsWebOrigin and then add it to the CrossDomainAuthorizationList:

$x = New-CsWebOrigin -Url “{https://thoughtstuff.co.uk}”
Set-CsWebServiceConfiguration -Identity “{YOUR_IDENTITY}” -CrossDomainAuthorizationList @{Add=$x}

You have to add separate entries for http and https, and any specific port numbers (ie thoughtstuff.co.uk is different to thoughtstuff.co.uk:8080)

Localhost

For developers, this can be a problem. A lot of development work is done on localhost. You have some options. Either, don’t use localhost and move your development to a server within a “trusted” domain for your UCWA development. The alternative (which is really only good if you have a test environment) is to add localhost to the CrossDomainAuthorizationList. You should be aware of the dangers of doing this though – you are letting anyone with a localhost (so, anyone) connect to your server. That’s why it’s only an acceptable solution for test environments.

On the Client

You’ll need to have some sort of web server running: even if you’re running on localhost. You can’t just write HTML/JS and then run it in your browser, because the domain will be file://… which won’t be recognized by the server as a valid domain.

You can use IIS if you have it on your system. If not, I use nginx because it’s fast, it doesn’t need installation and it just works.

Fiddler would also be on my list of should-haves – it’s very useful for diagnosing HTTP problems because it tells you exactly what’s going on in that pipe between your client and the server.

You’ll need something to write your HTML and JavaScript in: use whatever you’re happiest with. I use Notepad++ or SublimeText, depending on what mood I’m in.

 

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

4 Comments

  1. What happens when I execute the UCWA commands from a java program or a REST client? In that case too, do we need to whitelist any domains?

    Thanks,
    Rahul.

  2. Do i need to have these PreRequisites, even if i want to send an IM in Intranet
    I wanted to use Skype Web SDK and send an IM from my own account .

  3. If you run set-cswebserviceconfiguration on EVERY server in your environment when running Skype for Business, it just keeps on adding the same entries multiple times. It’s a little irrelevant for me, I can’t get any of them working no matter what. It seems that MSDN, and anyone else that posts about these decided to omit all the necessary details needed to get them working, but at the very least you could update your post to correct this error.

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.