Creating a Simple Echo Project using RestBC
Summary
This sample illustrates how to leverage RestBC in OpenESB to implement a simple Echo service. The Echo service simply returns the same input data by user using HTTP POST to the service.
How to Build the Sample Project
- First we need to create a BPEL project using NetBeans IDE
- Next, create a new WSDL document inside the BPEL project, choose Rest Inbound as the Binding to use in the wizard
- Next, add a "POST" operation, and give the operation a name, such as "echo". Then click the "Edit Operation" button to edit more details about this operation
- In the required "Path" textfield, put "/echo" as the URL path for the Echo service we wish to provision. For now, just leave everything else as default
- "Default HTTP Listener" by RestBC uses default port 9696
- After save changes to the WSDL document. Drag-n-drop the WSDL document into the BPEL editor on the left swim-lane.
- Add BPEL operators by drag-n-drop widgets from the right toolbox. We need "Receive", "Assign", and "Reply" operators in that order.
- Choose Partner-Links for the "Receive" and "Reply" operators. Then need to double-click the "Assign" operator to goto the BPEL mapper
- In the mapper, simply map "EchoIn->part1" to "EchoOut->part1". This implements the simple Echo logic.
- Save your changes
- Create a new Composite Application Project, and add the above created BPEL project to the Composite Application.
- Clean and build the Composition Application Project, then you should see something similar to the diagram show in the CASA Editor
- Deploy the CompApp Project to GlassfishESB server.
- Your Echo project is now running and ready to be tested.
- The service URL is here: "http://localhost:9696/echo
Running the Sample
- Use CURL tool to invoke the Echo service currently running
- First, let's try post a XML input data to the service, and see what happens
- Next, switch the HTTP Headers to indicate that we are posting and accepting JSON data instead of XML data, and see what happens
Sample Project Zip
- Attached is the reference project for the above steps
echo.zip
This page (revision-4) was last changed on
18-Dec-09 14:37 PM, -0800
by Edward Chou.
This page was created on
17-Dec-09 16:21 PM, -0800 by Edward Chou.
More info...