Technical Helpweb

Dialogic® PowerMedia™ Extended Media Server (PowerMedia XMS) - more articles

How to create JAXB classes in Client Library using msml xsd file

Introduction:

This article explains how to generate the JAXB classes when using MSML functionalities in Client Library with Dialogic® PowerMedia™ XMS.  


Background:

Client Library was developed to facilitate building sample applications and proof of concept demos, and to reproduce issues with PowerMedia XMS. Earlier versions of Client Library included samples for the RESTful API interface and the newest version also supports MSML. In order to build these MSML payloads, the Client Library uses Dialogic's MSML schema. This MSML schema needs to be converted to JAXB classes that can be used in the Java based library.


Procedure:

Client Library can be obtained from the Dialogic GitHub repository . Once at this site, use the "Download ZIP" button to download the project from the master branch.

Github-download.PNG 

Follow the Getting Started with XMS REST using Client Library article to set up the project in your IDE. After setting up the project, you will notice compilation errors for the MSML portion of the code. These errors are on the imports as the JAXB classes are missing in your workspace. In order to generate these classes follow the steps below:

NETBEANS

1. After building the project, you will notice import errors in Msml related classes as shown in the image below

Netbeans-import-errors.PNG 

2. To resolve this, use the xsd file(msml.xsd) provided as part of the project to generate the required classes.

a. The xsd file can be found under XMSClientLibrary/xml-resources/jaxb/XMSMsml/

Msml-xsd.PNG

 b. Right click on the java project -> New -> JAXB Binding

Create-JAXB.png

 c. Fill in the details to create the JAXB Binding. 

 JAXB-config.PNG

Binding Name -> Unique name

Select From Local System -> Browse through the project to get the file from XMSClientLibrary/xml-resources/jaxb/XMSMsml/

Package Name -> Set this as com.dialogic.xms.msml since this is the package name used in the classes

Click Finish

d. The above will create a folder under the project, containing the generated files from xsd.

 Generated-binding.PNG

Generated-files.PNG

ECLIPSE

1. Navigate to the location of the xsd file in Project Explorer. Right click on the schema (.xsd file) and select Generate -> JAXB Classes

Eclipse-schema.png

2. Select the java project, in this case XMSClientLibrary, click Next

Eclipse-select-project.png

3. Fill in the package name and click Finish

Eclipse-fill-details.PNG 

4. The above will create classes using xsd with com.dialogic.xms.msml as package name.

Eclipse-generated-classes.PNG


5. Right click on XMSClientLibrary in Project Explorer and "Build Project".


See also:
Getting Started with XMS REST Application Development using Sample XMS Java Client Library
XMSEchoTest - XMS Java Client Library Sample - for REST Application Development


Feedback

Please rate the usefulness of this page:  
0 - not useful at all
1 - potentially useful
2 - quite useful
3 - very useful
4 - exactly the information I needed     

Please enter a comment about this page:

First published: 19-May-2016
Open access: Product rule: open; Page rule: Auto