Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Hello World: WebSphere Enterprise Service Bus

Develop message flow for protocol transformation

Abelard Chow (abchow@ca.ibm.com), Advisory Software Developer, IBM
Abelard Chow
Abelard Chow is an Advisory Software Engineer with the IBM Scenario Analysis Lab, where he works on improving the cross-brand integration capability of IBM Software Group products. In the last few years, he served IBM customers as a Solution Architect in IBM Financial Industry Solution.
Bill Zhu (billzhu@ca.ibm.com), Software Developer, IBM
Bill Zhu is a software developer in the Scenario Analysis Lab team at the IBM Toronto Lab. His areas of expertise include solution design and implementation, e-commerce software, and messaging systems.

Summary:  Learn how to build message flow for protocol transformation. This tutorial demonstrates protocol transformation characteristics of WebSphere® Enterprise Service Bus. This is the fifth tutorial in the "Hello, World" series, which provides high-level overviews of various IBM® software products. WebSphere Enterprise Service Bus is designed to meet the connectivity and integration needs of Web Services applications and data. Customers who are interested improving their competitive edge with business transformation should consider an Enterprise Service Bus solution leveraging one of IBM's ESB products, such as WebSphere Enterprise Service Bus.

View more content in this series

Date:  07 Nov 2006
Level:  Intermediate PDF:  A4 and Letter (1193 KB | 27 pages)Get Adobe® Reader®

Activity:  45830 views
Comments:  

Protocol transformation

This exercise lets you practice using WebSphere Integration Developer and Service Component Architecture (SCA) to implement a WebSphere Enterprise Service Bus message flow that transforms a SOAP/HTTP request from the service requester to SOAP/JMS for the use of service provider.

As stated in Prerequisites, you need to have WebSphere Integration Developer V6.0.1.1 and WebSphere Enterprise Service Bus already installed to complete this exercise. To create a mediation module, complete the following steps:

Would you like to see these steps demonstrated for you?

Show meShow me

Starting WebSphere Integration Developer

  1. In the Windows task bar, select Start > All Programs > IBM WebSphere > Integration Developer V6.0.1 > WebSphere Integration Developer V6.0.1.
  2. Wait until WebSphere Integration Developer starts.

Creating a business object for the message flow

Use WebSphere Integration Developer to create a business object that is going to be used in the message flow:

  1. In the Business Integration perspective, select File > New > Business Object.
  2. Enter Customer in the Name field.

    Figure 8. New Business Object window
    New Business Object window

  3. Click New beside the Module field to create a mediation module that contains the business object.
  4. Select Create a mediation module project in the New Integration Project window. Click Next.
  5. Enter CustomerModule in the Module name field.
  6. Ensure WebSphere ESB Server v6.0 is selected as the target runtime.
  7. Uncheck Create mediation flow component. Click Finish.

    Figure 9. New Mediation Module window
    New Mediation Module window

  8. Click Finish again to close the New Business Object window and the Business Object editor should start automatically.
  9. In the Business Object editor, click Add Attribute to add a new attribute to the business object.

    Figure 10. Add attribute button
    Add attribute button

  10. Enter name in the highlighted field.
  11. Click Add Attribute again
  12. Enter address in the highlighted field. The completed business object should look like the following:

    Figure 11. Customer business object
    Customer business object

  13. Press Ctrl-S to save the business object.

Creating the WSDL file for the flow input

Use the WSDL editor in WebSphere Integration Developer to create an interface for the message flow.

  1. In the Business Integration view, expand CustomerModule, right-click on Interfaces and select New > Interface. A New Interface Wizard window opens:

    Figure 12. Create new interface
    Create new interface

  2. Enter AddCustomer in the Name field. Click Finish. This brings up the WSDL editor.
  3. Click Add One Way Operation to add an operation.

    Figure 13. Add One Way Operation button
    Add One Way Operation button

  4. Change the operation name to addCustomer.
  5. Click the Add Input button to add an input message part. An input message is created automatically for the addCustomer operation.

    Figure 14. Add Input button
    Add Input button

  6. Change the name to customer. This changes the message part name to customer.
  7. Change the type to Customer by clicking on the input type, scrolling down and selecting Customer business object. This changes the message part type to Customer business object.

    Figure 15. Select Customer business object
    Select Customer business object

  8. Press Ctrl-S to Save the WSDL file.

Using SCA to transform HTTP requests to JMS

Use SCA to transform HTTP requests to JMS.

  1. In the Business Integration view, expand CustomerModule and double-click CustomerModule to open the Assembly Diagram editor.
  2. Add an export component by clicking on the export icon in the palette of the Assembly Diagram editor, then click anywhere on the Assembly Diagram.

    Figure 16. Export button
    Export button

  3. The default export component is named Export1. Right-click on the export component and select Rename. Enter HTTPExport as the new name.
  4. Right-click on HTTPExport, then select Add Interface. An Add Interface window opens.
  5. Select AddCustomer and click OK.
  6. Right-click HTTPExport and select Generate Binding > Web Services Binding.
  7. Click Yes on the Binding File Generation window.
  8. Select soap/http and click OK on the Select Transport window.
  9. Add an import component by clicking on the import icon in the palette of the Assembly Diagram editor, then click anywhere on the Assembly Diagram.

    Figure 17. Import button
    Import button

  10. The default import component is named Import1. Right-click on the import component and select Rename. Enter JMSImport as the new name.
  11. Wire the HTTPExport to the JMSImport. Click OK in the Add Wire window. Your diagram should look like the following:

    Figure 18. Message flow
    Message flow

  12. Right-click on JMSImport and select Generate Binding > JMS Binding.
  13. In the window, select Text for the field Select how data is serialized between Business Object and JMS message.

    Figure 19. JMS Import Binding attribute selection window
    JMS Import Binding attribute selection window

  14. Click OK.
  15. Press Ctrl-S to save the assembly diagram.

Configuring the bus

Configure the WebSphere Enterprise Service Bus test server for the message flow you created:

  1. In the Servers view, start WebSphere Enterprise Service Bus server by right-clicking the WebSphere ESB server v6.0 instance and select start. Wait until the server starts.
  2. After the server starts, right-click on the server instance again and select Run the administrative console to start the administrative console.
  3. In the welcome page of administrative console, enter admin for the User ID and click Log in. You can use any value for the User ID.
  4. On the next page, click Service integration > Buses in the navigation panel.
  5. In the Bus section, click on SCA.APPLICATION.esbCell.Bus.

    Figure 20. Bus section
    Bus section

  6. In the Destination resources section, click Destinations:

    Figure 21. Destination resources section
    Destination resources section

  7. Click New to create a new destination.
  8. On the Create new destination page, select Queue, then click Next.
  9. Enter JMSImportOut in the identifier field. Click Next.
  10. On the Create new queue page, click Next.
  11. The Confirm queue creation page tells you that a new queue "JMSImportOut" will be created and a queue point for this queue will be created on the bus. Click Finish to confirm queue creation.
  12. Review the new queue JMSImportOut as it appears in the following destinations list:

    Figure 22. Destination list
    Destination list

  13. Click save and save again on the next page to apply the changes.
  14. Click Resources > JMS Providers > Default messaging on the navigation panel.
  15. A JMS queue connection factory is used to create connections to the associated JMS provider of JMS queues, for point-to-point messaging. In the Connection Factories section, click JMS queue connection factory.
  16. Click New in the Default message provider section.
  17. Enter myBindingQCF in the Name field
  18. Enter jms/myBindingQCF in the JNDI name field
  19. Select SCA.APPLICATION.esbCell.Bus in the Bus Name field. Your page should now look like the following:

    Figure 23. Queue connection factory attributes
    Queue connection factory attributes

  20. Click OK at the bottom of the page.
  21. A queue connection factory is now created and you should see the following entry in the Default messaging provider page:

    Figure 24. Default message provider page
    Default message provider page

  22. Click save here and again on the next page to apply the changes.
  23. Click Resources > JMS Providers > Default messaging on the navigation panel.
  24. A JMS queue is used as a destination for point-to-point messaging. In the Destinations section, click JMS queue.
  25. In the Default messaging provider page, click New.
  26. Enter JMSImportOut in the Name field.
  27. Enter jms/JMSImportOut in the JNDI name field.
  28. Select SCA.APPLICATION.esbCell.Bus in the Bus Name field. Make this selection first to enable the drop-down list in the Queue Name field.
  29. Select JMSImportOut in the Queue Name field. Your page should now look like the following:

    Figure 25. JMS Queue attributes
    JMS Queue attributes

  30. Click OK at the bottom of the page.
  31. A JMS queue is now created and you should see the following entry in the Default messaging provider page:

    Figure 26. JMS Queue displayed
    JMS Queue displayed

  32. Click save here and again on the next page to apply the changes.
  33. Click Logout to log out of the administrative console.

Configuring the mediation module to work on the bus

Configure the mediation module to work on the bus.

  1. In the Assembly diagram editor, select JMSImport.
  2. In the Properties view, select Binding.
  3. Enter jms/myBindingQCF in the JNDI Lookup Name field.

    Figure 27. Binding tab
    Binding tab

  4. Select the JMS Destinations tab and expand the Send Destination Properties.
  5. Enter jms/JMSImportOut in the JNDI Lookup Name field.

    Figure 28. JMS Destination tab
    JMS Destination tab

  6. Press Ctrl-S to save the module.

Testing using the integration test client

Use the integration test client provided in WebSphere Integration Developer to test the message flow created:

  1. In the Servers view, start WebSphere ESB server v6.0 if it's not already started.
  2. Right-click the server instance and select Add and remove projects.
  3. In the Add and Remove Project window, select CustomerModuleApp, then click Add to move CustomerModuleApp to the configured projects column. Click Finish. Wait until the execution completes.
  4. In the Assembly Diagram, right-click any white space and select Test Module.
  5. In the Initial request parameters table, enter John Smith for name and 8200 Warden for address.

    Figure 29. Request parameters
    Request parameters

  6. Click Continue to launch the request.
  7. In the Deployment Location windows, select WebSphere ESB server v6.0 as shown below:

    Figure 30. Deployment Location window
    Deployment Location window

  8. Click Finish and wait until execution completes. The following should appear once the execution is completed:

    Figure 31. Execution status
    Execution status

  9. Look at the message in the queue. In the Servers view, right-click on the WebSphere ESB server v6.0 instance and select Run administrative console.
  10. On the welcome page of the administrative console, enter admin for the User ID and click Log in. You can use any value for the User ID.
  11. Select Service integration > Buses > SCA.APPLICATION.esbCell.Bus > Destinations > JMSImportOut > Queue points > JMSImportOut@esbNode.server1-SCA.APPLICATION.esbCell.Bus.
  12. Click Runtime and the following page appears. The current message depth indicates how many messages are in the queue. This number increments by one each time a request is sent:

    Figure 32. Current message depth
    Current message depth

  13. To see the messages in the queue, click Messages. A list of messages appears. The message with the highest identifier is the most recent message.

    Figure 33. Message identifier
    Message identifier

  14. Click on the identifier link, and then click Message body to view the messages in the queue. Data shown in the red box is the data just sent.

    Figure 34. Message in queue
    Message in queue

  15. Click logout.

Generating the Web Services proxy

Would you like to see these steps demonstrated for you?

Show meShow me

To generate a Web Services client to access the message flow created:

  1. In the Servers view, start WebSphere ESB server v6.0 if it's not already started.
  2. Make sure CustomerModuleApp is already added to the server using Add and remove projects.
  3. Select File > New > Other....
  4. In the New window, check Show all Wizard.
  5. Expand the Web Service folder, select Web Service Client, and then click Next. Click OK if a confirmation box appears.

    Figure 35. New window
    New window

  6. In the next window, make sure Overwrite files without warning is checked. Click Next.
  7. Click Browse... and locate the HTTPExport_AddCustomerHttp_Service.wsdl file in the CustomerModuleWeb project. Click OK.

    Figure 36. Resource browser
    Resource browser

  8. Click Next. In the next window, click Next again.
  9. In the Web Service Proxy Page, click Finish.
  10. The Web Service proxy is now generated. Go to the Java perspective.
  11. In the Package Explorer view, expand CustomerModuleWeb > JavaSource > CustomerModule. The AddCustomerProxy and the corresponding files are the generated proxy.

    Figure 37. Generated proxy
    Generated proxy


Generating a sample JSP and accessing it using a browser

To generate a sample JSP that accesses the Web Service proxy created in the previous step:

  1. Select AddCustomerProxy.java.
  2. Right-click, then select WebServices > Generate Sample JSPs.
  3. In the Web Service Client page, uncheck all methods except addCustomer as shown below. Click Finish. The sample JSP is launched.

    Figure 38. Web Service Client window
    Web Service Client  window

  4. Select addCustomer in the Methods frame. Enter London in the address field and A. Smith in the name field. Click Invoke.

    Figure 39. Sample page
    Sample page

  5. Check the message in the queue by repeating steps 9 through 15 in Testing using the integration test client.

Exporting the mediation module for deployment in WebSphere Enterprise Service Bus

Now you have a message flow that runs in the test server and is ready to deploy. Complete the following steps to export the message flow as an EAR file that can be deployed in WebSphere Enterprise Service Bus as a normal J2EE application:

  1. In the Business Integration view, right-click on CustomerModule and select Export....
  2. Select EAR file in the Export window. Click Next.
  3. Select CustomerModuleApp in the EAR project filed.
  4. Enter a location in the Destination field. Click Finish.
  5. The EAR file is exported and ready for deployment.

7 of 10 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Business process management, WebSphere, SOA and web services
ArticleID=172115
TutorialTitle=Hello World: WebSphere Enterprise Service Bus
publish-date=11072006
author1-email=abchow@ca.ibm.com
author1-email-cc=
author2-email=billzhu@ca.ibm.com
author2-email-cc=