Import a web service into WebSphere Application Server
The first step is to import a server application in Rational Application Developer V8 that you can use it to deploy and run your web service server. The server must be set up to let you configure applications directly in the administrative console.
- Download the WSRM_WSS.zip file at the bottom of this article and extract the RAD_BankServer.zip file.
- Start Rational Application Developer V8.
- Import the project by selecting File => Import. In the Import window, select Other => Project Interchange and then select Next.
- Browse to the RAD project file that you downloaded, select All, and then select Finish.
- After importing the project, you may get a Java build path error, so make sure that all JAR files are added in the build path to eliminate those errors. You should see the project structures as shown below:
BankClient and BankServer project structure in Rational Application Developer

- To deploy BankServerEAR on WebSphere Application Server, right-click on the WebSphere Application Server V8 runtime and click Add and Remove Projects, as shown below:
Open Add and Remove Projects

- Under Available projects, select BankServerEAR and then click Add. After it is added under Configured projects, click Finish, as shown below:
Deploy BankServerEAR on WebSphere Application Server

If you want to create your own server application, import the RAD_WSDL.zip file provided with this article.
Import Web Service Client in WebSphere Message Broker
The next step is to import the Consumer/Client flow in WebSphere Message Broker V8 so that you can use it to deploy and run your web service and web service client.
- Start WebSphere Message Broker V8 Toolkit.
- WMB_BankApplication_PI.zip has already been imported. You should see the project structures as shown in .
- In the BankMessageFlowProject, double-click on WSRM_ConsumerFlow.msgflow. You should see the flow shown below:
WSRM_ConsumerFlow message flow

This flow behaves like a web service client. SOAPRequest nodes in of this flow can send SOAP requests to provider applications.
- The WSRMINPUTQ (MQInput) node receives the message. The Compute node after the MQInput node gets the operation name and sets it into the local environment variable to route the message.
- The RoutetoLable node routes the message to the appropriate Label node. The message sent to the Label node will be in XMLNSC format and therefore must be converted into a SOAP message. For that purpose, a Compute node is included after every Label node.
- The CreateAccount Label receives CreateAccount requests and propagates them to the ComputeCreateAccount node. Then the CreateAccount SOAPRequest node sends the SOAP request to the service application and waits for a response. After a response is received, it is propagated to the CreateResponse Compute node. If a fault message is received, it is propagated to the CreateFaultResponse Compute node.
- The CreditRequest Label receives the CreditRequest requests and propagates them to the ComputeCreditRequest node. Then the CreditRequest SOAPRequest node sends the request to the service application. No response is sent back to the SOAPRequest node because it is a one-way operation. The DebitRequest Label receives DebitRequest requests and propagates them to the ComputeDebitRequest node. Then the SOAPRequest node sends the request to the service application. No response is sent back to the SOAPRequest node as it is a one-way operation.
- The CheckBalance Label receives CheckBalance requests and propagates them to the ComputeCheckBalance node. Then the SOAPRequest node sends the request to the service application and waits for a response. After the response is received, it is propagated to the CreateResponse Compute node. If a fault message is received, it is propagated to the CreateFaultResponse Compute node.
- The CreateResponse compute node converts the SOAP message into the XMLNSC message and propagates it to the WSRMRESPONSEQ (MQOutput) node.
- The CreateFaultResponse Compute node propagates the same message to the WSRMFAULTRESPONSEQ (MQOutput) node.
- Create an execution group named BankConsumer.
- Create the following local queues:
- WSRMINPUTQ
- WSRMRESPONSEQ
- WSRMFAULTRESPONSEQ
- You must check the port used by the WebSphere Application Service on WebSphere Application Server. To do so, complete the following steps:
- Open Rational Application Developer.
- Navigate to BankServer => ejbModule => META-INF => wsdl. Right-click on BankMessageSetService.wsdl and select Open With => Text Editor.
- In BankMessageSetService.wsdl, search for <soap:address and check the port value.
- In the BankMessageFlowProject, open WSRM_ConsumerFlow.msgflow. Open the HTTP Transport tab in the Properties view of each SOAPRequest node, and check the port. If the port is already correct, you do not need to do anything. Otherwise, change the port in the web service URL field to the correct port for your web service server, and save the flow.
- In the BankMessageFlowProject, open the BankConsumer BAR file. Select the Prepare tab and ensure that the WSRM_ConsumerFlow message flow and its message set are selected. Click Build and Save.
- Deploy the BAR file on the BankConsumer execution group.
- Under BankMessageFlowProject => Flow Tests, open Requester.mbtest. Use the first Enqueue to send a message.
- Select Dequeue and click Get Message. You should get the response shown below:
Create account response message

Now both client and server applications are ready to apply WS-RM and WS-Security.
Importing and applying the policy set and bindings to the client and server applications
All the required EAR, keystore, XML, and ZIP files for policy sets and bindings are provided with this article. Complete the following steps to make use of them.
Import and apply the policy set and binding in Rational Application Developer
- Import the WMB_Provider_Policy.zip file provided with this article into Rational Application Developer using the following steps:
- Select File => Import in Rational Application Developer.
- Select WebSphere Policy Sets under Web service and click Next as shown in .
- Browse to the WMB_Provider_Policy.zip file in the next window and click Finish.
- Now attach this policy set and binding to BankServer service, using the following steps:
- Navigate to BankServer => Services.
- Right-click on BankMessageSetSOAP_HTTP_Service and select Manage Policy Set Attachment, as shown below:
Attach policy set in Rational Application Developer

- In the Add Policy Set Attachment window, click Add.
- In Configure Policy Set and Binding window, select WMB Provider Policy under Policy Set and select Provider sample under Binding, as shown below:
Attach policy set and binding in Rational Application Developer

- Click OK and then click Finish.
Import and apply the policy set and binding in WebSphere Application Server
The next step is to import the WMB Provider policy and apply it to the BankServerEAR file in the administrative console, using the following steps:
- To launch the administrative console, right-click the WebSphere Application Server V8 runtime and click Administration => Run administrative console, as shown in .
- Select Services => Policy Sets => Application policy sets, as shown in . You will see some of the most common policy set configurations already available. For the banking example, import Bank Provider Policy: click Import and select from the selected location.
- Browse to WMB_Provider_Policy.zip and click OK.
- After you save the changes, you should see WMB Provider Policy in the Application Policy Sets list.
- Select Applications => Application Types => WebSphere enterprise applications, as shown below. You should see that BankServerEAR is already available.
BankServerEAR in administrative console

- Click on BankServerEAR.
- Select Service client policy set and bindings under Web services properties.
- Select the check boxes for BankServerEAR and BankMessageSetSOAP_HTTP_Service. Click the Attach Client Policy Set dropdown box and select WMB Provider Policy:
Attach server policy set in the administrative console

- Save the changes.
- Again, select the check boxes for BankServerEAR and BankMessageSetSOAP_HTTP_Service. Click the Assign Binding dropdown box and select WMB Provider custom Binding.
After you save the changes, you should see the screen shown below. Go back to Applications => Application Types => WebSphere enterprise applications and restart BankServerEAR.
Attach server policy and binding in administrative console

If you face any issues while attaching the policy set or binding, import the BankServerEAR.ear file provided with this article into the administrative console using the following steps:
- In the administrative console, select Applications => Application Types => WebSphere enterprise applications. Select the checkbox for BankServerEAR and click Uninstall.
- In the next window, click OK and save the changes.
- Click Install. Browse to BankServerEAR.ear and click Next.
- Complete the installation with the default configuration by clicking Next.
- Save the installation and start BankServerEAR.
Set up keystore and truststore and import the policy set and bindings in WebSphere Message Broker
- You have already downloaded keystore and XML files into the KeyStore folder on your local system.
- Store WSSecurity-WSRMConsumerBinding.xml as well in the KeyStore folder on the local system.
- The BankConsumer execution group is used as a consumer. To set up the keystore and truststore on the BankConsumer execution group, run the following commands on the runtime command console:
Setup keystore and truststore on BankConsumer execution groupmqsichangeproperties <Broker Name> -e BankConsumer -o ComIbmJVMManager -n truststoreFile -v c:\KeyStore\client.keystore mqsichangeproperties <Broker Name> -e BankConsumer -o ComIbmJVMManager -n keystoreFile -v c:\KeyStore\client.keystore mqsichangeproperties <Broker Name> -e BankConsumer -o ComIbmJVMManager -n keystorePass -v clientKeystore::password mqsichangeproperties <Broker Name> -e BankConsumer -o ComIbmJVMManager -n truststorePass -v clientTruststore::password mqsichangeproperties <Broker Name> -e BankConsumer -o ComIbmJVMManager -n keystoreType -v jks mqsichangeproperties <Broker Name> -e BankConsumer -o ComIbmJVMManager -n truststoreType -v jks mqsistop <Broker Name> mqsisetdbparms <Broker Name> -n clientKeystore::password -u NA -p clientpass mqsisetdbparms <Broker Name> -n clientTruststore::password -u NA -p clientpass mqsistart <Broker Name> - You have already created a policy set with WS-Security and WS_RM, and this policy set can be used here as well.
Run the following commands to create and import the consumer policy binding on runtime command console:
Create and Import the consumer policy binding on runtime command consolemqsicreateconfigurableservice <broker name> -c PolicySetBindings -o WSSecurity-WSRMConsumerBinding mqsichangeproperties <broker name> -c PolicySetBindings -o WSSecurity-WSRMConsumerBinding -n associatedPolicySet -v WSSecurity-WSRMPolicySet mqsichangeproperties <broker name> -c PolicySetBindings -o WSSecurity-WSRMConsumerBinding -n ws-security -p c:\KeyStore\WSSecurity-WSRMConsumerBinding.xml - Open WebSphere Message Broker Explorer. Right click on <BrokerName> and select Properties.
- Under Security and Policy, select Policy Sets.
- The WSSecurity-WSRMPolicySet (with WS-RM and WS-Security) policy set, WSSecurity-WSRMProviderBinding binding, and WSSecurity-WSRMConsumerBinding binding must be listed there as shown below:
Policy set with WS-RM, WS-Security, and bindings in WebSphere Message Broker Explorer

Now your execution group, policy set, and binding are ready to use.
Apply the policy set and bindings to the consumer flow
You must apply the policy set and bindings on the flow so that they can run with WS-RM and WS-Security enabled.
- You can call the consumer by using WebSphere MQ. Only application messages reach the message flow, and if you want to see the additional WS-RM protocol messages such as create sequence,
terminate sequence, message number, and the signed and encrypted messages that are passed between the provider and consumer, then you must set up a TCP/IP Monitor, as shown below:
- The port used by the application server should be same as before.
- In the workbench, go to Window => Preferences => Run/Debug => TCP/IP Monitor.
- Ensure that Show the TCP/IP Monitor view when there is activity is selected.
- Click Add. Set the Local monitoring port to an unused port on your system, such as 6666.
- Set the Type to TCP/IP.
- Set the Host name to localhost.
- Set Port to the port on which the application server is running.
- Click OK. You should see the screen shown below:
TCP/IP Monitor configuration

- Select the TCP/IP Monitor that you have just created and click Start.
- You have set up a TCP/IP Monitor to receive messages sent to an unused port on your system, such as 6666, and forward them to the server.
- In the BankMessageFlowProject, open WSRM_ConsumerFlow.msgflow. Open the HTTP Transport tab in the Properties view of each SOAPRequest node, and check the port. If the port is already correct, you do not need to do anything. Otherwise, change the port in the Web service URL field to the correct port for your TCP/IP and save the flow.
- In the BankMessageFlowProject, open the BankConsumer BAR file and rebuild it. Select the Manage at bottom left and select WSRM_ConsumerFlow.cmf.
- In the Consumer Policy Set field, click Edit and select the WSSecurity-WSRMPolicySet policy that you associated with the provider flow.
- In the Consumer Policy Set Bindings field, click Edit and select the WSSecurity-WSRMConsumerBinding binding that you imported, which is not the same binding that you associated with
the provider flow. You should see the screen shown below:
BankConsumer BAR file with policy set and bindings applied

- Save and deploy the BAR file on the BankConsumer execution group.
Test the web service application with WS-RM and WS-Security enabled
- Open Requester.mbtest under BankMessageFlowProject => Flow Tests. Use the first Enqueue to send a request message to create an account.
You can see in the TCP/IP monitor that the message is encrypted and has a sequence number in it. For example: <wsrm:MessageNumber>1</wsrm:MessageNumber>.
Now select Dequeue and click Get Message. You should get the message shown below:
Create Account Response Message

- Select the second Enqueue to send a CreditRequest and the third Enqueue to send a DebitRequest. No response will be received, since they are one-way operations.
- Select the fourth Enqueue to send a CheckBalance request. Now select Dequeue and click Get Message.
The balance value should be 50.00 as one credit request credits the account with 100.00 while one debit request debits the account with 50.00. You should get the message shown below:
Check Balance Response Message

- You can check in the TCP/IP Monitor that all requests and responses are encrypted and in sequence. You should get the create sequence messages and SOAP header as shown below:
Messages in TCP/IP Monitor

This article showed you how to configure WebSphere Message Broker to use WS-RM and WS-Security together to communicate with JAX-WS clients and web services running on WebSphere Application Server. Enabling WS-RM and WS-Security on client and server enables the reliable message delivery of encrypted data without additional coding by the client or web service provider.
| Description | Name | Size | Download method |
|---|---|---|---|
| Code samples | WSRM_WSS.zip | 250 KB | HTTP |
Information about download methods
- Web services resources
- Web Services Reliable Messaging Specification V1.1.
The WS-RM specification from OASIS describes a protocol that enables messages to be transferred reliably between nodes implementing this protocol in the presence of software component, system, or network failures. - Introduction to Web Services Reliable Messaging
An excellent technical introduction to WS-RM. - Implementing the Web Services Security standard
This developerWorks article shows you how to implement WS-Security to secure a web service. -
Web Services Reliable Messaging support in WebSphere Application Server V8
These topics in the WebSphere Application Server V8 information center show you how to implement WS-RM in WebSphere Application Server V8. -
Web Services Security support in WebSphere Application Server V8
These topics in the WebSphere Application Server V8 information center show you how to configure WS-Security and bindings in WebSphere Application Server V8. -
Applying Web Services Reliable Messaging to a web service, Part 1: A hands-on approach using WebSphere Application Server V8 and Rational Application Developer V7.5
This developerWorks article shows you how to configure WS-RM for a JAX-WS web service and web service client. - Developing a Web Services Reliable Messaging solution using WebSphere Message Broker V8
This developerWorks article shows you how WebSphere Message Broker V8 supports WS-RM. -
Configuring Web Services Reliable Messaging in WebSphere Message Broker V8
This topic in the WebSphere Message Broker V8 information center shows you how to configure message flows to use WS-RM.
- Web Services Reliable Messaging Specification V1.1.
- WebSphere Application Server resources
-
WebSphere Application Server V8 information center
A single Web portal to all WebSphere Application Server documentation, with conceptual, task, and reference information on installing, configuring, and using WebSphere Application Server. - WebSphere Application Server developer resources page
Technical resources to help you use WebSphere Application Server. - WebSphere Application Server product page
Product descriptions, product news, training information, support information, and more. - WebSphere Application Server information roadmaps
Roadmap of articles and resources to help you with installation, migration, administration, development, troubleshooting, and understanding the underlying technology. - WebSphere Application Server documentation library
WebSphere Application Server product manuals. - WebSphere Application Server support
A searchable database of support problems and their solutions, plus downloads, fixes, and problem tracking. - Download a free trial version of WebSphere Application Server V7
WebSphere Application Server V7 is a Java EE 5 certified, EJB 3.0 supported application platform that drives business agility with an innovative, performance based foundation for your SOA environment on the broadest range of platforms in the industry.
-
WebSphere Application Server V8 information center
- WebSphere Message Broker resources
- WebSphere Message Broker V8 information center
A single Web portal to all WebSphere Message Broker V8 documentation, with conceptual, task, and reference information on installing, configuring, and using your WebSphere Message Broker environment. - WebSphere Message Broker developer resources page
Technical resources to help you use WebSphere Message Broker for connectivity, universal data transformation, and enterprise-level integration of disparate services, applications, and platforms to power your SOA. - WebSphere Message Broker product page
Product descriptions, product news, training information, support information, and more. - Download free trial version of WebSphere Message Broker
WebSphere Message Broker is an ESB built for universal connectivity and transformation in heterogeneous IT environments. It distributes information and data generated by business events in real time to people, applications, and devices throughout your extended enterprise and beyond. - WebSphere Message Broker documentation library
WebSphere Message Broker specifications and manuals. - WebSphere Message Broker forum
Get answers to technical questions and share your expertise with other WebSphere Message Broker users. - WebSphere Message Broker support page
A searchable database of support problems and their solutions, plus downloads, fixes, and problem tracking. - IBM Training course: WebSphere Message Broker V8 Development
This course from IBM Training shows you how to use the components of the WebSphere Message Broker development and runtime environments to develop and troubleshoot message flows that use ESQL, Java, and PHP to transform messages. - Youtube tutorial: Integrating Microsoft .NET code in a WebSphere Message Broker V8 message flow
This five-minute youtube tutorial shows you how simple it is to use WebSphere Message Broker V8 to build a message flow that includes Microsoft .NET code. Microsoft Visual Studio is used to build .NET code in C#, which is then integrated into a message flow using Message Broker and an HTTP RESTful interface.
- WebSphere Message Broker V8 information center
- WebSphere resources
- developerWorks WebSphere developer resources
Technical information and resources for developers who use WebSphere products. developerWorks WebSphere provides product downloads, how-to information, support resources, and a free technical library of more than 2000 technical articles, tutorials, best practices, IBM Redbooks, and online product manuals. - developerWorks WebSphere application integration developer resources
How-to articles, downloads, tutorials, education, product info, and other resources to help you build WebSphere application integration and business integration solutions. - Most popular WebSphere trial downloads
No-charge trial downloads for key WebSphere products. - WebSphere forums
Product-specific forums where you can get answers to your technical questions and share your expertise with other WebSphere users. - WebSphere on-demand demos
Download and watch these self-running demos, and learn how WebSphere products and technologies can help your company respond to the rapidly changing and increasingly complex business environment. - WebSphere-related articles on developerWorks
Over 3000 edited and categorized articles on WebSphere and related technologies by top practitioners and consultants inside and outside IBM. Search for what you need. - developerWorks WebSphere weekly newsletter
The developerWorks newsletter gives you the latest articles and information only on those topics that interest you. In addition to WebSphere, you can select from Java, Linux, Open source, Rational, SOA, Web services, and other topics. Subscribe now and design your custom mailing. - WebSphere-related books from IBM Press
Convenient online ordering through Barnes & Noble. - WebSphere-related events
Conferences, trade shows, Webcasts, and other events around the world of interest to WebSphere developers.
- developerWorks WebSphere developer resources
- developerWorks resources
- Trial downloads for IBM software products
No-charge trial downloads for selected IBM® DB2®, Lotus®, Rational®, Tivoli®, and WebSphere® products. - developerWorks business process management developer resources
BPM how-to articles, downloads, tutorials, education, product info, and other resources to help you model, assemble, deploy, and manage business processes. - developerWorks blogs
Join a conversation with developerWorks users and authors, and IBM editors and developers. - developerWorks tech briefings
Free technical sessions by IBM experts to accelerate your learning curve and help you succeed in your most challenging software projects. Sessions range from one-hour virtual briefings to half-day and full-day live sessions in cities worldwide. - developerWorks podcasts
Listen to interesting and offbeat interviews and discussions with software innovators. - developerWorks on Twitter
Check out recent Twitter messages and URLs. - IBM Education Assistant
A collection of multimedia educational modules that will help you better understand IBM software products and use them more effectively to meet your business requirements.
- Trial downloads for IBM software products

Shelly Gupta is a Software Engineer on the WebSphere Message Broker Development Team in India. She is a post-graduate from Banasthali Vidhyapeeth in Jaipur, India, and has been working for IBM for five years. You can contact Shelly at shellgup@in.ibm.com.




