diff --git a/apps/demo/cord-gui/pom.xml b/apps/demo/cord-gui/pom.xml
index ff31ea8..f644409 100644
--- a/apps/demo/cord-gui/pom.xml
+++ b/apps/demo/cord-gui/pom.xml
@@ -48,8 +48,18 @@
             <artifactId>jersey-servlet</artifactId>
             <version>1.19</version>
         </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-client</artifactId>
+            <version>1.19</version>
+        </dependency>
 
         <dependency>
+            <groupId>com.google.sitebricks</groupId>
+            <artifactId>slf4j</artifactId>
+            <version>0.8.3</version>
+        </dependency>
+        <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
             <version>2.4</version>
diff --git a/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/XosManager.java b/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/XosManager.java
index e0ce191..4264e6b 100644
--- a/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/XosManager.java
+++ b/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/XosManager.java
@@ -21,6 +21,8 @@
 import org.onosproject.cord.gui.model.SubscriberUser;
 import org.onosproject.cord.gui.model.XosFunction;
 import org.onosproject.cord.gui.model.XosFunctionDescriptor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.Set;
 
@@ -29,20 +31,21 @@
  */
 public class XosManager {
 
-    private static final String XOS_HOST = "10.254.1.22";
-    private static final String XOS_PORT = "8000";
+    private static final String URI_BASE = "/rs/subscriber/";
 
-    private static final String URL_FMT = "http://%s:%s/xoslib/rs/subscriber/";
-
-    private static final String BASE_URL =
-            String.format(URL_FMT, XOS_HOST, XOS_PORT);
-
+    private final XosManagerRestUtils xosUtils = new XosManagerRestUtils(URI_BASE);
+    private final Logger log = LoggerFactory.getLogger(getClass());
 
     /**
      * No instantiation (except via unit test).
      */
     XosManager() {}
 
+
+    private String subId(int subscriberId) {
+        return String.format("%d/", subscriberId);
+    }
+
     /**
      * Configure XOS to enable the functions that compose the given bundle,
      * and disable all the others, for the given subscriber.
@@ -51,12 +54,14 @@
      * @param bundle new bundle to set
      */
     public void setNewBundle(int subscriberId, Bundle bundle) {
-        System.out.println("\n>> Set New Bundle : " + bundle.descriptor().id());
+        log.info("\n>> Set New Bundle : " + bundle.descriptor().id());
 
-        String urlFmt = xosUrl(subscriberId) + "services/%s/%s";
+        String uriFmt = subId(subscriberId) + "services/%s/%s";
         Set<XosFunctionDescriptor> inBundle = bundle.descriptor().functions();
         for (XosFunctionDescriptor xfd: XosFunctionDescriptor.values()) {
-            xosEnableFunction(urlFmt, xfd, inBundle.contains(xfd));
+            String uri = String.format(uriFmt, xfd.id(), inBundle.contains(xfd));
+            String result = xosUtils.putRest(uri);
+            // TODO: convert JSON result to object and check (if we care)
         }
     }
 
@@ -69,35 +74,17 @@
      * @param user user (containing function state)
      */
     public void apply(int subscriberId, XosFunction func, SubscriberUser user) {
-        System.out.println("\n>> Apply : " + func + " for " + user);
+        log.info("\n>> Apply : " + func + " for " + user);
 
-        String urlPrefix = xosUrl(subscriberId) + "users/" + user.id() + "/";
-        String url = urlPrefix + func.xosUrlApply(user);
-        restPut(url);
+        String uriPrefix = subId(subscriberId) + "users/" + user.id() + "/";
+        String uri = uriPrefix + func.xosUrlApply(user);
+        String result = xosUtils.putRest(uri);
+        // TODO: convert JSON result to object and check (if we care)
     }
 
 
     // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-    private String xosUrl(int subscriberId) {
-        return BASE_URL + String.format("%d/", subscriberId);
-    }
-
-    private void xosEnableFunction(String urlFmt, XosFunctionDescriptor xfd,
-                                   boolean enable) {
-        String url = String.format(urlFmt, xfd.id(), enable);
-        restPut(url);
-    }
-
-    // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-    private void restPut(String url) {
-        // TODO: wire up to Jackson client...
-        System.out.println("<<PUT>> " + url);
-    }
-
-    // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
     /**
      * Singleton instance.
      */
diff --git a/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/XosManagerRestUtils.java b/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/XosManagerRestUtils.java
new file mode 100644
index 0000000..b8e8a4c
--- /dev/null
+++ b/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/XosManagerRestUtils.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onosproject.cord.gui;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientHandlerException;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+import org.slf4j.Logger;
+
+import static com.google.common.net.MediaType.JSON_UTF_8;
+import static java.net.HttpURLConnection.*;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Utility RESTful methods for dealing with the XOS server.
+ */
+public class XosManagerRestUtils {
+    private static final String TEST_XOS_SERVER_ADDRESS = "10.254.1.22";
+    private static final int TEST_XOS_SERVER_PORT = 8000;
+    private static final String XOSLIB = "/xoslib";
+    private static final String AUTH_USER = "padmin@vicci.org";
+    private static final String AUTH_PASS = "letmein";
+
+    private static final String UTF_8 = JSON_UTF_8.toString();
+
+    private final Logger log = getLogger(getClass());
+
+    private final String xosServerAddress;
+    private final int xosServerPort;
+    private final String baseUri;
+
+    /**
+     * Constructs a utility class for the default server address and port,
+     * using the given base URI.
+     * <p>
+     * Note that the uri should start and end with a slash; for example:
+     * {@code "/volttenant/"}. This example would result in URIs of the form:
+     * <pre>
+     *     "http://10.254.1.22:8000/xoslib/volttenant/"
+     * </pre>
+     *
+     * @param baseUri base URI
+     */
+    public XosManagerRestUtils(String baseUri) {
+        this(TEST_XOS_SERVER_ADDRESS, TEST_XOS_SERVER_PORT, baseUri);
+    }
+
+    /**
+     * Constructs a utility class, using the supplied server address and port,
+     * using the given base URI.
+     * <p>
+     * Note that the uri should start and end with a slash; for example:
+     * {@code "/volttenant/"}. This example would result in URIs of the form:
+     * <pre>
+     *     "http://[server]:[port]/xoslib/volttenant/"
+     * </pre>
+     *
+     * @param xosServerAddress server IP address
+     * @param xosServerPort server port
+     * @param baseUri base URI
+     */
+    public XosManagerRestUtils(String xosServerAddress, int xosServerPort,
+                               String baseUri) {
+        this.xosServerAddress = xosServerAddress;
+        this.xosServerPort = xosServerPort;
+        this.baseUri = baseUri;
+    }
+
+    // build the base URL from the pieces we know...
+    private String baseUrl() {
+        return "http://" + xosServerAddress + ":" +
+                Integer.toString(xosServerPort) + XOSLIB + baseUri;
+    }
+
+    /**
+     * Gets a client web resource builder for the base XOS REST API
+     * with no additional URI.
+     *
+     * @return web resource builder
+     */
+    public WebResource.Builder getClientBuilder() {
+        return getClientBuilder("");
+    }
+
+    /**
+     * Gets a client web resource builder for the base XOS REST API
+     * with an optional additional URI.
+     *
+     * @param uri URI suffix to append to base URI
+     * @return web resource builder
+     */
+    public WebResource.Builder getClientBuilder(String uri) {
+        Client client = Client.create();
+        client.addFilter(new HTTPBasicAuthFilter(AUTH_USER, AUTH_PASS));
+        WebResource resource = client.resource(baseUrl() + uri);
+        return resource.accept(UTF_8).type(UTF_8);
+    }
+
+    /**
+     * Performs a REST GET operation on the base XOS REST URI.
+     *
+     * @return JSON string fetched by the GET operation
+     */
+    public String getRest() {
+        return getRest("");
+    }
+
+    /**
+     * Performs a REST GET operation on the base XOS REST URI with
+     * an optional additional URI.
+     *
+     * @param uri URI suffix to append to base URI
+     * @return JSON string fetched by the GET operation
+     */
+    public String getRest(String uri) {
+        WebResource.Builder builder = getClientBuilder(uri);
+        ClientResponse response = builder.get(ClientResponse.class);
+
+        if (response.getStatus() != HTTP_OK) {
+            log.info("REST GET request returned error code {}",
+                     response.getStatus());
+        }
+        String jsonString = response.getEntity(String.class);
+        log.info("JSON read:\n{}", jsonString);
+
+        return jsonString;
+    }
+
+    /**
+     * Performs a REST PUT operation on the base XOS REST URI.
+     *
+     * @return JSON string returned by the PUT operation
+     */
+    public String putRest() {
+        return putRest("");
+    }
+
+    /**
+     * Performs a REST PUT operation on the base XOS REST URI with
+     * an optional additional URI.
+     *
+     * @param uri URI suffix to append to base URI
+     * @return JSON string returned by the PUT operation
+     */
+    public String putRest(String uri) {
+        WebResource.Builder builder = getClientBuilder(uri);
+        ClientResponse response;
+
+        try {
+            response = builder.put(ClientResponse.class);
+        } catch (ClientHandlerException e) {
+            log.warn("Unable to contact REST server: {}", e.getMessage());
+            return "";
+        }
+
+        if (response.getStatus() != HTTP_OK) {
+            log.info("REST PUT request returned error code {}",
+                     response.getStatus());
+        }
+        String jsonString = response.getEntity(String.class);
+        log.info("JSON read:\n{}", jsonString);
+
+        return jsonString;
+    }
+
+    /**
+     * Performs a REST POST operation of a json string on the base
+     * XOS REST URI with an optional additional URI.
+     *
+     * @param json JSON string to post
+     */
+    public void postRest(String json) {
+        postRest("", json);
+    }
+
+    /**
+     * Performs a REST POST operation of a json string on the base
+     * XOS REST URI with an optional additional URI suffix.
+     *
+     * @param uri URI suffix to append to base URI
+     * @param json JSON string to post
+     */
+    public void postRest(String uri, String json) {
+        WebResource.Builder builder = getClientBuilder(uri);
+        ClientResponse response;
+
+        try {
+            response = builder.post(ClientResponse.class, json);
+        } catch (ClientHandlerException e) {
+            log.warn("Unable to contact REST server: {}", e.getMessage());
+            return;
+        }
+
+        if (response.getStatus() != HTTP_CREATED) {
+            log.info("REST POST request returned error code {}",
+                     response.getStatus());
+        }
+    }
+
+    /**
+     * Performs a REST DELETE operation on the base
+     * XOS REST URI with an optional additional URI.
+     *
+     * @param uri URI suffix to append to base URI
+     */
+    public void deleteRest(String uri) {
+        WebResource.Builder builder = getClientBuilder(uri);
+        ClientResponse response = builder.delete(ClientResponse.class);
+
+        if (response.getStatus() != HTTP_NO_CONTENT) {
+            log.info("REST DELETE request returned error code {}",
+                     response.getStatus());
+        }
+    }
+
+}
