WebCenter Portal - Access to WC Spaces Services over REST running on Oracle VM from your Mobile Application

Dec 18, 2013 10:24:18 AM

By: Andreja Sambolec - Application Consultant

Developing ADF Mobile application – accessing WC services running on VM

If you are using the Oracle SOA Suite/BPM Suite VirtualBox Appliance (Pre-Built Developer VM for Oracle VM VirtualBox) and want to start developing an ADF Mobile application accessing WC Spaces REST services running on this VM, you have to make sure:

  • Your mobile device and local machine have access to the same wireless network
  • NAT is selected as the available network mode on your VM

portal1

  • To check Port Forwarding

potral2

Now you can access WebCenter Spaces from your mobile device or from your local machine using IP address of your local machine: http://192.168.1.33:8888/rest/api/resourceIndex

In your ADF Mobile application, create a new connection:

portal3

If you want use programmatic approach for Spaces REST Service invocation, use the following:

RestServiceAdapter restServiceAdapter = Model.createRestServiceAdapter();
restServiceAdapter.clearRequestProperties();
restServiceAdapter.setConnectionName("WCRest");
restServiceAdapter.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
String theUsername = "weblogic";
String thePassword = "welcome1";
String userPassword = theUsername + ":" + thePassword;
String encoding = new sun.misc.BASE64Encoder().encode(userPassword.getBytes());
restServiceAdapter.addRequestProperty("Authorization", "Basic " + encoding);
restServiceAdapter.addRequestProperty("Accept", "application/json; charset=UTF-8");
restServiceAdapter.addRequestProperty("Content-Type", "application/json; charset=UTF-8");

restServiceAdapter.setRetryLimit(0);

restServiceAdapter.setRequestURI("/rest/api/resourceIndex");

try {

System.out.println(restServiceAdapter.send(""));

} catch (Exception e) {

e.printStackTrace();

}

Using ADB tool and command adb logcat, you can see the part of the response as a result of the command System.out.println(restServiceAdapter.send("")):

{"version":"11.1.1.6.0","resourceType":"urn:oracle:webcenter:
resourceindex","links":[{"href":"http://192.168.1.33:8888/rest/api/discussions/forums?utoken=FJnkGqA-W6YrfhjgagLvMj_AJapY_w**","template":"http://192.168.1.33:8888/rest/api/discussions/forums?startIndex={startIndex}&itemsPerPage={itemsPerPage}&utoken=FJnkGqA-W6YrfhjgagLvMj_AJapY_w**","resourceType":"urn:oracle:webcenter:discussions:forums","capabilities":"urn:oracle:webcenter:read"},{"href":"http://192.168.1.33:8888/rest/api/preferences/general?utoken=FJnkGqA-W6YrfhjgagLvMj_AJapY_w**","resourceType":"urn:oracle:webcenter:preferences:general","capabilities":"urn:oracle:webcenter:read"},{"href":"http://192.168.1.33:8888/rest/api/spaces/siteresources?utoken=FJnkGqA-W6YrfhjgagLvMj_AJapY_w**","template":"http://192.168.1.33:8888/rest/api/spaces/siteresources?projection={projection}&q={q}&utoken=FJnkGqA-W6YrfhjgagLvMj_AJapY_w**","resourceType":"urn:oracle:webcenter:spaces:siteresources","capabilities":"urn:oracle:webcenter:read"},{"href":"http://192.168 ...

After the above verification of access to WebCenter Spaces REST Services you can continue with development.

Running into trouble? Want to have a chat with members from TEAM? Contact us here.

Subscribe by Email

No Comments Yet

Let us know what you think