Transforming REST models into IBM Worklight adaptors

IBM® Worklight adapters are the server-side code of applications that are deployed on the IBM Worklight mobile application platform, and mediate between the mobile devices such as smartphones and tablets and the back-end services such as IBM WebSphere® Application Server. You can generate IBM Worklight adapters and mobile clients stubs that use the procedures that are provided by the adapters in an IBM Worklight project from a Representational State Transfer (REST) model or a Java™ API for RESTful Web Services (JAX-RS) model by running the UML-to-Worklight transformation.

Before you begin

You must have the REST or JAX-RS modeling capability enabled.

Procedure

  1. Create a UML-to-Worklight transformation configuration: Click File > New > Transformation Configuration > Worklight Transformation > UML-to-Worklight Transformation, and complete the steps in the wizard.
  2. Specify the following values in the transformation configuration file:
    1. On the Specify a Configuration Name and Transformation page, in the Protocol field, select Conceptual.
    2. On the Source and Target page, select a REST service model or JAX-RS service model as the source and an IBM Worklight project as the target.
    3. On the same Source and Target page, select the following options to generate procedures and methods during the transformation:
      • Generate Adapter Procedures: Select this option to generate the implementation of JavaScript procedures and XML descriptors from a REST service model.
      • Generate Application Methods: Select this option to generate the client side methods from a REST or JAX-RS service model for mobile devices.
  3. Click File > Save.

What to do next

You can now run the transformation and generate Worklight application code. For information about running transformations, see the related link at the end of this topic.
Note: IBM Worklight supports only following content types:
{
   "errors": [
      "Runtime: java.lang.IllegalArgumentException: Http content type '*\/*' not supported. Supported types are: [json, css, csv, javascript, plain, xml, html]"
   ],
   "info": [
   ],
   "isSuccessful": false,
   "warnings": [
   ]
}
You must validate the content types during the UML-to-Worklight transformation.

Feedback