Category: developer studio

Understanding WSO2 Data Mapper 5.0.0

Understanding WSO2 Data Mapper 5.0.0

INTRODUCTION

WSO2 data mapper is a data mapping solution that convert and transform one format of data to a different format. It provides a WSO2 Developer Studio based tool to create the graphical mapping configuration and generate the files needed to execute the mapping configuration by the WSO2 Data mapper engine.

This is the second of WSO2 Data Mapper posts which will explain about WSO2 Data Mapper from the user perspective. First post was to describe the end to end work flow on how to create, deploy and test data mapper configuration.(How to Use WSO2 Data Mapping Mediator in ESB)

COMPONENTS OF WSO2 DATA MAPPER

Before we going into look the operations lets look how things happen under the hood. WSO2 Data Mapper comes as two components ideally. They are Data Mapper Engine and Data Mapper Tooling component.

Data Mapper Tooling component

Data Mapper Tooling component is the interface to user to create configuration files needed for engine to execute the mapping. There are three configuration files needed by the Data Mapper engine. They are,

  1. Input schema file
  2. Output schema file
  3. Mapping configuration file

Input schema and output schema defines the input/output format of input message and required message. It is basically  a custom defined json schema. It will be generated by the Data Mapper tool for you when loading the input and output files.

inputType

As above image shows user can load input/output message format in several different ways. They are,

  • XML – Sample XML file
  • JSON- Sample JSON file
  • CSV  – Sample CSV file with column names as the first record
  • XSD  – XSD file which is actually schema for XML files
  • JSONSCHEMA – WSO2 data mapper json schema
  • CONNECTOR

I guess only CONNECTOR option is the confusing part for you. It is to use data mapper with connectors straightly. WSO2 connectors will contain json schemas for each operations which will define the message formats both it will respond and expect. So when user integrate connectors in a project this connector option will search through the workspace and find the available connectors. Then user can select the respective connector and the operation so that related json schema will be loaded for data mapper by the tool.

Mapping configuration file is simply a Java Script file generated looking at the diagram user will draw in the data mapper diagram editor by connecting input elements to output elements. Every operation user defines in diagram will convert to Java Script operation.

So these three files will be generated by the Data Mapper Tool and saved in a Registry Resource project to deploy in a wso2 server.

regresource.png

“.datamapper” and “.datamapper_diagram” files contain meta data related to Data Mapper Diagram. They will be ignored when trying to deploy in a server to use by data mapper engine. Only two schema files and .dmc (data mapper configuration) file will be deploy.

Need an Intermediate Component to Use With WSO2 Products

WSO2 Data Mapper is an independent component. It is not depending on any other WSO2 product. But other products can use data mapper to achieve/offer data mapping capability. For that we need a intermediate component. Data Mapper Mediator is this intermediate component which  will give the data mapping capability into WSO2 ESB.

DMMediator.png

Data Mapper Mediator will find the configuration files from the registry and configure data mapper engine with the input message type(XML/JSON/CSV) and output message type(XML/JSON/CSV) . Then it will take request message from ESB message flow and use configured data mapper engine to execute the transformation and output message will be added to ESB message flow.

Can Use Product Specific Runtime Variables

Data Mapper engine also given a way to use run time product specific variables in the mapping. The way it works is, intermediate component should construct a map object containing run time product specific variables and send it to  data mapper engine. So when the mapping happens in the data mapper engine, these variables will be available. For Eg: Data Mapper Mediator provides esb axis2/transport/synapse/axis2client/operation/.. properties like this. In the Data Mapper diagram user can use the Property operator and define the scope and the property name and use it in the mapping. Data Mapper Mediator will identify the required properties to execute the mapping and populate a map with the required properties and will send it to engine. We will look it with more detail when we discuss about Property Operator.

Data Mapper Engine

Data Mapper engine need basically following information to be configured,

  • Input Message Type
  • Output Message Type
  • Input schema
  • Output schema
  • Mapping configuration

At the runtime it will get the input message and runtime variable map object and output the transformed message. To execute the mapping configuration data mapper engine use java scripting api. So if your runtime is JAVA 7 rhino JS engine will be used and if your runtime is JAVA 8 nashorn JS engine will be used.

There are several limitations in the rhino engine that will directly affect data mapper engine when JAVA 7 is used. There are several functions that will not support in rhino,

for eg: String object functions like startsWith() endsWith()

So user may need to aware of that when using custom functions and operators, rhino may have limitations executing those.

OPERATIONS IN WSO2 DATA MAPPER

Let’s look into the operations we could use to do the mapping. Following diagram shows the WSO2 Data Mapping Diagram Editor.

diagramEditor.png

As you can see in the left side we have the operations pallet. These operations can be drag and drop to the Editor area.

There are six categories listed down

  • Links
  • Common
  • Arithmetic
  • Conditional
  • Boolean
  • Type Conversion
  • String

LINKS

DataMapperLink.gif Data Mapping Link- map elements with other operators and elements.

COMMON

Constant Constant- define string, number or boolean constant values.

CustomFunction Custom Function – define custom function to use in mapping

Properties Properties – use product specific runtime variables

GlobalVariable Global Variable – instantiate global variable to access from any where

Compare Compare – compare two inputs in the mapping

ARITHMETIC

Add Add – add two numbers

Subtract Subtract – subtract two or more numbers

Multiply Multiply – multiply two or more numbers

Divide Divide –  divide two numbers

Celi Ceiling – get the ceiling value of a number (closest larger integer value)

Floor Floor – get the floor value of a number (closest lower integer value)

Round Round – get the nearest integer value

SetPrecision Set Precision – Format a number into a specified length

AbsoluteValue Absolute Value – get the absolute value of a rational number

Min Min – get the minimum number from given inputs

Max Max – get the maximum number from given inputs

CONDITIONAL

IfElse IfElse – use a condition and select one input from two

BOOLEAN

AND AND – boolean AND operation on inputs

OR OR – boolean OR operation on inputs

NOT NOT – boolean NOT operation

TYPE CONVERSION

StringToNumber StringToNumber – convert string value to number (“0” -> 0)

StringToBoolean StringToBoolean – convert string value to boolean(“true” -> true)

ToString ToString – convert number or boolean to string

STRING

Concat Concat – concat two or more strings

Split Split – split a string by a matching string value

UpperCase Uppercase – convert a string to uppercase letters

LowerCase Lowercase – convert a string to lowercase letters

StringLength String Length – get the length of the string

StartsWith StratsWith – check whether string starts with a specific value (JAVA7)

EndsWith EndsWith – check whether string ends with a specific value (JAVA7)

Substring Substring – extract a part of the string value

Trim Trim – remove white spaces from beginning and end of a string

Replace Replace – replace the first occurrence of a target string with other

Match Match – check whether the input match with a (JS)regular expression

We will discuss more on some of the operations in the next post.

 

How to Connect with WSO2 ESB Server in Debug Mode

How to Connect with WSO2 ESB Server in Debug Mode

I have written a post before on WSO2 mediation debugger as “How to Debug WSO2 Mediation Flow” which guides through the basic steps to use WSO2 Mediation Debugger. It may not contain each and every detail because then it would be a one large post (which no one will read). 🙂 🙂

This is a one of the posts in many to come which describes the WSO2 Mediation Debugger features in detail for users need more than the basic requirements. Here I will discuss about how to connect with WSO2 ESB Server in mediation debug mode.

PREREQUISITES

First we need to have the mediation debugger supported ESB distribution. WSO2 ESB 5.0.0 is the distribution packed with mediation debugger. You can download latest pack from here. (https://github.com/wso2/product-esb/releases/)

And also we need to have a debugger supported Developer Studio ESB Tool. You can follow this article to install the WSO2 ESB Tool 5.0.0. ( https://github.com/wso2/devstudio-tooling-esb/releases)

Some of you may confused in the previous post ESB Tooling version is 4.1.0 and now 5.0.0. We decided to change the Tooling version to 5.0.0 since it is the version of WSO2 ESB runtime. As you may already know from now onwards each wso2 product will ship with three components as runtime (WSO2 ESB server), tooling (WSO2 ESB Tooling) and analytics(WSO2 ESB Analytics). If we had different versions for these three components it may confuse the  user to find the compatible versions to work together for the one product.

RMCfLEWgTJmandVGXcSG_Confused Superman

 

 

So now all three components will come under same version. (For ESB it is 5.0.0) 🙂

OVERVIEW

 

There are two ways we could connect ESB tool with ESB server to deploy artifacts. They are we could start esb server from terminal by executing wso2server.sh  script in the bin folder and add to ESB tool as a remote server or we could add a esb as a wso2 server in the ESB tool and start.

We can debug the esb mediation flow in both above mentioned occasions.

Starting WSO2 ESB Server with Independently and Connect ESB Tool to Debug

We can navigate to server file location bin folder from the terminal and execute wso2server.sh as follows to start esb server.

startserverterminal

But to support mediation debugging we need to provide command line arguments as “-Desb.debug=super”.

Then the ESB server will listen on two ports to connect with Developer Studio ESB Mediation Debugger as configured in the [esbserver]/repository/conf/sypanse.properties file.

#configuration for the external debugger channels if server is started in debug mode
synapse.debugger.port.command=9005
synapse.debugger.port.event=9006

Then we have to connect esb tool with esb server by execution above created debug configuration. We have roughly 1 minute time span to connect, otherwise esb server will stop listening and start the server without connecting with debugger tool.

So we should first build the debug configuration from the WSO2 ESB Tool before starting the ESB Server in the debug mode.

Go to Debug Configurations in the ESB Tool and you will see a type of debug configuration named ESB Mediation Debugger

debugconfigclosemediationdebugger.png

Then double click on ESB Mediation Debugger and you will get configuration dialog as below.

defaultconfig.png

It will contain the default command port and event port as 9005 and 9006 with your local host name.

If you want to change the default ports, you should modify both server synapse.properties file and this configuration parameters.

And you can remote debug a server which is running in a different host by modifying the Server host with it’s ip.

Now start the ESB Server in the mediation debug mode with the command “sh wso2server.sh -Desb.debug=super” and click the Debug button when server listing to the ports as bellow.

listining.png

Then the server will be in the mediation debug mode and connected with ESB tool.

Starting WSO2 ESB Server with from ESB Tool and Connect to Server in Debug Mode

If you want to start esb server from esb tool and debug you need to give “-Desb.debug=true” argument to start the server.

First add esb server into ESB tool. Goto server view and create a new server.

serverview

selectESBserver

Actually ESB Server version is not much critical here, most important part is the Server runtime environment. It should be WSO2 Carbon 4.4 based server.

Then select WSO2 ESB Server 5.0.0 and give the esb server home folder location from the Add link.

browsetosetesbhome

Then finish the server configuration. This is the normal way to add a wso2 server for developer studio.

Now if we want to start esb server in the debug mode we have to provide the argument to server start up.So go to run/debug configurations and double click Generic server.

genericserver

argumentstab2.png

And go to Arguments tab and add Program arguments “-Desb.debug=super”. Apply the changes and finish the configuration.

Then start the server from the server view and esb server will listen to debug ports as we saw earlier.

Can We Remote Debug and Mediation Debug in the Same Time???

The answer is YES. You could start the esb server by giving the command

“sh wso2server.sh debug 5005 -Desb.debug=super”

It will first listen on the port 5005 to connect with esb source and then stop and listen to ports 9005 and 9006.

You can try ESB Mediation Debugger more and report the bugs and suggest improvements from the following link as JIRAs.

 

How Run Developer Studio Code from Source

How Run Developer Studio Code from Source

INTRODUCTION

This post is for developers who would like develop tooling for WSO2. WSO2 Developer Studio also moved in to a kernel-based model with its new architecture revamp in version 4.0.0. WSO2 Developer Studio Kernel provides a set of common plug-ins, which can be used to develop Eclipse plug-ins for WSO2 products that are based on WSO2 Carbon platform.  All the product specific plug-ins will use the Developer Studio Kernel as the base for their respective tooling implementation.

If you have used WSO2 Developer Studio you know that previous versions include tooling support for create many WSO2 product artifacts. But actually a user may not need tooling support for all of these products. User may only use few products in the production. So now onwards user can select what he only needs and install those.

PREREQUISITES

At the time I’m writing this post Developer Studio has released new version based on Eclipse mars2 as WSO2 Developer Studio Kernel 4.1.0. I will guide you to clone the source and how to run the code of ESB Tooling 5.0.0 which is based on 4.1.0 kernel of Developer Studio.

First you may need Eclipse Mars 2 distribution and you can it from here.

1. Install Required Developer Studio Features

The next step is to install the features required for the plug-ins we are going to develop. We need Developer Studio Kernel 4.1.0 and platform bundles for ESB Tooling plug-ins. So install the above features on the downloaded Eclipse.

2. Clone the Source to Local Machine

ESB Tooling repository can be found in here. Fork the repository and for your git and clone from there to your local machine.

git clone https://github.com/your-acount/devstudio-tooling-esb

3. Import Source to Eclipse

importCommand.png

existingProjectSection.png

sourcefolders

Now you will have the ESB Tooling source on your Eclipse and start implementing tooling.

4. Run Developer Studio from Source

You can run the developed plug-ins and test the code. You need to run it as Eclipse Application as shown in the following diagram.

Go to Run Configurations and Eclipse Application

runconfiguration

When you click the run button it will start a new Eclipse application with your plug-ins in the workspace.

How to Install Developer Studio ESB Tool

How to Install Developer Studio ESB Tool

As you may already know WSO2 have changed the product strategy to provide a runtime along with tooling and analytics. So now on wso2 each product will come with a runtime, tooling and analytics.

Screen Shot 2015-12-08 at 1.11.43 PM
WSO2 Product Strategy

For example for the latest product ESB you will find three components.

  • Runtime : WSO2 ESB 5.0.0
  • Tooling : WSO2 Developer Studio ESB Tooling 5.0.0
  • Analytics : WSO2 ESB Analytics 5.0.0

This tutorial will guide you install WSO2 Developer Studio ESB Tooling with the new tooling strategy.

New WSO2 Developer Studio Tooling Strategy

WSO2 Developer Studio also moved in to a kernel-based model with its new architecture revamp in version 4.0.0. WSO2 Developer Studio Kernel provides a set of common plug-ins, which can be used to develop Eclipse plug-ins for WSO2 products that are based on WSO2 Carbon platform.  All the product specific plug-ins will use the Developer Studio Kernel as the base for their respective tooling implementation.

If you have used WSO2 Developer Studio you know that previous versions include tooling support for create many WSO2 product artifacts. But actually a user may not need tooling support for all of these products. User may only use few products in the production. So now onwards user can select what he only needs and install those.

So now you can install only the ESB tooling support with developer studio. There are several ways to get this done.

  1. Install on top of Eclipse distribution
  2. Install on top of WSO2 Developer Studio Kernel
  3. Download the WSO2 Developer Studio ESB Tool Installed Distribution

1. Install on top of Eclipse distribution

Lets install WSO2 Developer Studio ESB Tooling 5.0.0.

First we need to have a compatible Eclipse Distribution. WSO2 Developer Studio ESB Tooling 5.0.0 is based on WSO2 Developer Studio Kernel 4.1.0. As WSO2 Developer Studio Kernel based on Eclipse mars ( Eclipse 4.5) we need to have Eclipse Mars distribution. You  can download it from here. Download the respective version according to your OS.

Now you have the Eclipse compatible eclipse distribution to install WSO2 Developer Studio ESB Tooling. You can download the beta2 composite P2 from here. Composite P2 will contain both ESB tooling and Developer Studio kernel features bundled together. So You can directly install the downloaded composite p2 in Eclipse.

Following are the steps to install composite p2 to Eclipse.

  1. Goto Eclipse help->Install New Software… installNewSoftwareClose
  2. Add composite P2 as a repositoryinstallDialogAddRepository
  3. Click Archive button and select the composite p2 form the file system
  4. selectcompositezipThen software installation dialog will show the feature list of the composite p2. Select all features.esbtoolfeatures
  5. Remove the check of Contact all update sites check box and click the next button.untickbutton
  6. Then you will ask to accept license of the software and to restart after installation.

After restating the Eclipse you will have a Eclipse with WSO2 Developer Studio ESB Tooling capabilities.

 

2. Install on top of WSO2 Developer Studio Kernel

If you already have a Eclipse with WSO2 Developer Studio Kernel, you only need to install  ESB Tooling features. You can download the beta2 main p2 of WSO2 Developer Studio ESB Tooling from here.

You can install the downloaded main p2 on WSO2 Developer Studio Kernel by following the above mentioned steps.

3. Download the WSO2 Developer Studio ESB Tool Installed Distribution

If you don’t have a compatible eclipse distribution you can download WSO2 Developer Studio ESB Tooling install distribution which contain Eclipse distribution, developer studio kernel and esb tooling together. You only need to extract and run.

You can see the all beta2 release in here.

Download Links

 

 

How to Change the Default Editor in the WSO2 Developer Studio

How to Change the Default Editor in the WSO2 Developer Studio

WSO2 Developer Studio is an Eclipse-based SOA development environment for develop artifacts and deploy them in WSO2 products. Generally it provides both diagram editor and source editor to create artifacts as shown in the following diagrams.

sourceEditor
Source Editor
diagramEditor
Diagram Editor

Preference can be changed from developer to developer which editor to use. So developer studio now provides the capability to select the preferred editor as the default editor and continue developing as developer’s preference.
Following are the steps to change the default editor.

  1. Go to Eclipse preferencespreferencetabclose
  2. Go to File Associations property viewfileAssociationsclose
  3. Select *.xml file type and it will show associated editors list.associatedEditors
  4. To change it to XML Editor as the default editor select XML Editor from the Associated editors list and select as Default.setXMLasdefualt
  5. Then XML editor will come to the top of the list and then click OK button to close preference dialog.finishclose
  6. After configuring as above when you open an artifact it will open with XML editorxmleditorview

If you want to change the default editor back to ESB diagram editor, you can follow the same steps and set the ESB Editor as the default editor.

 

 

 

How to Deploy Web Services in WSO2 Application Server using WSO2 Developer Studio

How to Deploy Web Services in WSO2 Application Server using WSO2 Developer Studio

Introduction

This post mainly target to give you the process of deploying web services in WSO2 Application Server. We will use WSO2 Developer Studio 3.8.0 and WSO2 Application server 5.3.0 for this tutorial.

Create a simple Web Service

Create a simple JAX-RS service following the post “Develop JAX-RS Web Service Easily Using WSO2 Developer Studio”

webserviceprojectCreate a C-APP Project

Go to Developer Studio Dashboard and click Composite Application Project listed in Distribution section. And create a CAPP project named CAPP_Application_server and select check button of the Web service project you want to host in Application Server.capp_creation

Developer Studio will create you a CAPP project which can be deploy directly into WSO2 Application server. Isn’t that great!!!

Add and Start WSO2 Application Server from Developer Studio

There are two ways to do this.
  1. Application server can be add to Developer Studio as a server and then you can do every server operation through Developer Studio.
    • Go to Server tab in Developer Studio. This window can be found in bottom section or by following
      • Menu-bar-> Window -> Show view->Serversservers_tab
    • Right click inside window and go for New->Server Menu. Select
      • WSO2 -> WSO2 Carbon 4.4 based server (Since WSO2 AS 5.3.0 is based on WSO2 Carbon 4.4.0)add_new_server
    • Go to Next page of wizard add AS server distribution home folder location as CARBON_HOME section.carbon_server_path
    • Next page shows port configurations and other useful information. Then finish the configuration and start server.
  2. Application server can be started externally and add to Developer Studio as a remote server.
    • Start Application Server externally server_externally_startAS_server_started_externallyhttps://192.168.1.4:9443/carbon/ will be the default server url.
    • Go to server tab and New-> Server menu. Select
      • WSO2 -> remote Serverremote_server_urlFill the server url with running server url and finish the configuration.

Add CAPP to Application Server

Now WSO2 server is up and running in our system. You can now deploy the your web service.

  • Right click on Developer Studio server tab we created in previous step and goto command Add and Removeadd_remove
  • Then Dialog will pop-up listing available CAPP’s in the workspace. Select your CAPP created in previous step and finish the configuration.
  • Your service will deploy in to Application server and up and running.succesfullydeployed
  • You can go to Application Server management console from browser and see your service

servicemanagementconsole

Develop JAX-RS Web Service Easily Using WSO2 Developer Studio

Develop JAX-RS Web Service Easily Using WSO2 Developer Studio

INTRODUCTION

This post will guide you to develop a JAX-RS Web Service using WSO2 Developer Studio and host it in WSO2 Application server and test it.

First if you don’t have WSO2 Developer Studio installed, install developer studio. We will use WSO2 Application Server to host our application and test it by using Rest Easy extension in Firefox or Google Chrome.

SAMPLE SCENARIO

We will implement an employee information web service for a company. In this sample service, information is stored in a HashMap. This web service is able to register an employee, get information using the employee ID and update or modify information.

IMPLEMENTING SERVICE CLASSES

  1. Open the Developer Studio Dashboard and click JAX-RS Service Project.
  2. Click Create New JAX-RS Service and then click Next.
  3. Enter EmployeeManagementJAXRSProject as the project name, com.employee.management.jaxrs.service as the package name and EmployeeManagementService as the class name.
  4. Click Finish. The project structure is created.
  5. Implement the service class and two bean classes for response messages, as shown below:
EmployeeManagementService.java
package com.employee.management.jaxrs.service;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import com.employee.management.jaxrs.beans.Employee;
import com.employee.management.jaxrs.beans.Message;
@Path("/employee")
public class EmployeeManagementService {
    public static Map<String, Map<String, String>> employees = new HashMap<>();
    @POST
    @Consumes("text/plain")
    @Produces("text/xml")
    @Path("/insert/query")
    public Response insertEmployee(@QueryParam("id") String id,
         @QueryParam("name") String name,
         @QueryParam("designation") String designation,
         @QueryParam("salary") String salary) {
     id = id.trim();
     if (!employees.containsKey(id)) {
         Map<String, String> info = new HashMap<>();
         info.put("name", name);
         info.put("designation", designation);
         info.put("salary", salary);
         employees.put(id, info);
         Message msg = new Message();
         msg.setMessage("Successfully registered");
         return Response.ok(msg).build();
     }
     Message msg = new Message();
     msg.setMessage("Employee id already registered");
     return Response.ok(msg).build();
    }
    @POST
    @Consumes("text/plain")
    @Produces("text/xml")
    @Path("/update/designation")
    public Response updateEmployeeDesignation(@QueryParam("id") String id,
         @QueryParam("designation") String designation) {
     id = id.trim();
     if (employees.containsKey(id)) {
         Map<String, String> info = new HashMap<>();
         info = employees.get(id);
         info.put("designation", designation);
         Message msg = new Message();
         msg.setMessage("Successfully updated");
         return Response.ok(msg).build();
     }
     Message msg = new Message();
     msg.setMessage("Employee id is not registered");
     return Response.ok(msg).build();
    }
    @POST
    @Consumes("text/plain")
    @Produces("text/xml")
    @Path("/update/salary")
    public Response updateEmployeeSalary(@QueryParam("id") String id,
         @QueryParam("salary") String salary) {
     id = id.trim();
     if (employees.containsKey(id)) {
         Map<String, String> info = new HashMap<>();
         info = employees.get(id);
         info.put("salary", salary);
         Message msg = new Message();
         msg.setMessage("Successfully updated");
         return Response.ok(msg).build();
     }
     Message msg = new Message();
     msg.setMessage("Employee id is not registered");
     return Response.ok(msg).build();
    }
    @POST
    @Consumes("text/plain")
    @Produces("text/xml")
    @Path("/update/name")
    public Response updateEmployeeName(@QueryParam("id") String id,
         @QueryParam("name") String name) {
     id = id.trim();
     if (employees.containsKey(id)) {
         Map<String, String> info = new HashMap<>();
         info = employees.get(id);
         info.put("name", name);
         Message msg = new Message();
         msg.setMessage("Successfully updated");
         return Response.ok(msg).build();
     }
     Message msg = new Message();
     msg.setMessage("Employee id is not registered");
     return Response.ok(msg).build();
    }
    @GET
    @Consumes("text/plain")
    @Produces("text/xml")
    @Path("/get/{id}")
    public Response getEmployee(@PathParam("id") String id) {
     id = id.trim();
     if (employees.containsKey(id)) {
         Map<String, String> info = new HashMap<>();
         info = employees.get(id);
         Employee entity = new Employee();
         entity.setId(id);
         entity.setName(info.get("name"));
         entity.setDesignation(info.get("designation"));
         entity.setSalary(info.get("salary"));
         return Response.ok(entity).build();
     }
     Message msg = new Message();
     msg.setMessage("ID is not registered");
     return Response.ok(msg).build();
    }
}
Employee.java
package com.employee.management.jaxrs.beans;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Employee")
public class Employee {
    private String id;
    private String name;
    private String designation;
    private String salary;
    public String getId() {
     return id;
    }
    public void setId(String id) {
     this.id = id;
    }
    public String getName() {
     return name;
    }
    public void setName(String name) {
     this.name = name;
    }
    public String getDesignation() {
     return designation;
    }
    public void setDesignation(String designation) {
     this.designation = designation;
    }
    public String getSalary() {
     return salary;
    }
    public void setSalary(String salary) {
     this.salary = salary;
    }
}
Message.java
package com.employee.management.jaxrs.beans;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Message")
public class Message {
    private String message;
    public String getMessage() {
     return message;
    }
    public void setMessage(String message) {
     this.message = message;
    }
    
}

6 Create a C-App project and deploy it to the Application Server.

Testing the service

You can test the sample service using the REST Easy extension from Firefox or Google Chrome.

Test the operations for registering an employee, update/modify and get information, as shown below.

Register employee

http://localhost:9763/EmployeeManagementJAXRSProject-1.0.0/services/employee_management_service/employee/insert/query?id=1&name=NAME&designation=DESIGNATION&salary=SALARY_AMOUNT

Get employee information

http://localhost:9763/EmployeeManagementJAXRSProject-1.0.0/services/employee_management_service/employee/get/index

Update employee name

http://localhost:9763/EmployeeManagementJAXRSProject-1.0.0/services/employee_management_service/employee/update/name?id=1&name=NAME_MODIFIED

Update employee designation

http://10.100.7.83:9763/EmployeeManagementJAXRSProject-1.0.0/services/employee_management_service/employee/update/designation?id=1&designation=DESIGNATION_MODIFIED

Update employee salary

http://10.100.7.83:9763/EmployeeManagementJAXRSProject-1.0.0/services/employee_management_service/employee/update/salary?id=1&salary=SALARY_MODIFIED

Information after modifications

How to Download and Install WSO2 Developer Studio

How to Download and Install WSO2 Developer Studio

INTRODUCTION

WSO2 Developer Studio is a complete tooling platform where you can easily develop, deploy, test and debug your SOA applications. Developer Studio works in the popular open-source integrated development environment (IDE) Eclipse. By integrating with the award-winning WSO2 Carbon platform, Developer Studio enables you to create, deploy, and manage a variety of artifacts.

INSTALLATION

You can find developer studio in Eclipse Market place and install into your Eclipse. Or you can go to Developer Studio site and download directly.There you can find two options.

  • Download Developer Studio with Eclipse.

If you don’t have eclipse already go ahead and download developer studio installed eclipse. You can simply download from site, extract and run.

  • Download Developer Studio distribution and install manually.

But if you have a compatible eclipse version with developer studio, you can download the developer studio distribution and install it manually. If you have download the distribution follow below steps to install.

  • Go to Eclipse install new software menu.install new software command
  • Browse through file system and locate distribution zip file into location.Locate the developer studio distribution
  • Select Developer studio features to install. (remove check box selection for contact all update sites …)Select Features to install
  • Then accept license and install.

After successfully installing Developer Studio, you are ready to start develop, test and deploy composite middleware applications easily and faster.