Creating the HTTPESB Web Application
The HTTPESB demo Web application is composed of one HTML file, the HTTPESB servlet, and the ESB implementation classes.
Create the Web Application Directory Structure
Populate the Web Application Directory Structure
- Create a directory in your servlet container's webapps directory named httpesb.
- Create a child directory of httpesb named WEB-INF.
- Create a child directory of WEB-INF named classes.
- Create a child directory of WEB-INF named lib.
- Copy the Mule jar file and DTD file from the Mini-Mule dist directory to the WEB-INF/lib directory.
- Copy all the jar files from the Mini-Mule lib directory to the WEB-INF/lib directory.
- Compile all the Java files for the ESB to the WEB-INF/classes directory.
- Create a text file named web.xml in the "WEB-INF" directory and populate the file as shown in Listing 7.
- Create a text file named index.html in the httpesb directory and populate the file as shown below.
Testing the ESB
<!—NOTE: The following URI should be a single line.
Message:<br/><textarea name="Message" cols=60
<input type="submit" value="Send Message">
Figure 5. Testing the ESB: After installing and configuring Mule and the sample application, when you run it, you'll see a page that looks like this.
Figure 6. A Successful Message: When you send a message successfully, you'll see a page similar to the one shown here.
After installing and configuring the application, to test it from your browser, type the following URL into the address field:
You'll see a page similar to Figure 5
Type "Hello world!" into the message box and hit the "Send Message" button. You should now see a page similar to Figure 6
If you now look at the console window for your application server, you should see more detailed messagessomething similar to Figure 7.
|Figure 7. Detailed Output: The sample application displays detailed messages in the console window.|
To integrate old and new components and services using a service-oriented architecture requires an infrastructure that can connect any component or service, regardless of location, messaging protocol, and message format. An enterprise service bus fulfills these requirements with a centralized, scalable, fault-tolerant, service-messaging framework. An ESB provides a transparent means for communicating with heterogeneous services over a diverse set of message protocols.
Mule is an ESB messaging platform based on a staged event-driven architecture (SEDA). Mule can send and receive messages using asynchronous, synchronous, and request/response processing models. You can use Mule alone or as a simple messaging framework to build a robust, advanced enterprise service bus.