Index Changes

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

001.png

  • Next, create a new WSDL document inside the BPEL project, choose Rest Inbound as the Binding to use in the wizard

002.png

  • 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
003.png
  • 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
004.png
  • 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
005.png
  • In the mapper, simply map "EchoIn->part1" to "EchoOut->part1". This implements the simple Echo logic.
006.png
  • 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
007.png
  • 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
008.png
  • Next, switch the HTTP Headers to indicate that we are posting and accepting JSON data instead of XML data, and see what happens
009.png

Sample Project Zip

  • Attached is the reference project for the above steps
echo.zip(info)

JSPWiki v2.4.100
[RSS]
« Home Index Changes Prefs
This page (revision-4) was last changed on 18-Dec-09 14:37 PM, -0800 by Edward Chou