You are on page 1of 39

Simplicio plugin for Web Services

How to implement a Web Service provider/consumer with Rational Software Architect ?

Version 2.0 07/06/2010

Roadmap
Table of content

1 Request/Reply Web Service SOADIAG Echo


1.1 Implement a Provider
1.2 Implement a Consumer

2 Publish/Subscribe Web Service SOADIAG Echo Event


2.1 Implement a Publisher

2.2 Implement a Subscriber

1 Request/Reply summary
Reminder

A request/reply Web Service SOADIAGEcho is defined in SOAREPO, we will:


- Provide an implementation of this service - Implement a consumer of this service

We need:
- Rational Software Architect - Simplicio plugins for Web Services

Roadmap
Table of content

1 Request/Reply Web Service SOADIAG Echo


1.1 Implement a Provider
1.2 Implement a Consumer

2 Publish/Subscribe Web Service SOADIAG Echo Event


2.1 Implement a Publisher

2.2 Implement a Subscriber

1.1 Web Service provider SOADIAGEcho


Setup project

We create a Dynamic Web Project named EchoProvider and we add Simplicio Web Services Facet

1.1 Web Service provider SOADIAGEcho


Provider Wizard

1. Activate contextual menu on project AFKLM>Web Services>Provider Wizard 2. Select SOA repository 3. Set Application SOADIAG 4. Press Search 5. Select SoadiagEcho 6. Click on Next

1.1 Web Service provider SOADIAGEcho


Provider Wizard

Click twice on Next and once on Finish button

1.1 Web Service provider SOADIAGEcho


Provider layout

Spring is configured WSDL is copied Code is generated in src-gen

1.1 Web Service provider SOADIAGEcho


Provider implementation

Implement the provider:


Implement the interface Put @WebService annotation

1.1 Web Service provider SOADIAGEcho


Provider configuration

Update the spring configuration file and set:


url as "/ws/it/connectivity/000039v01" Service implementation class as "com.afklm.soadiag.ws.echo.EchoServiceImpl"

10

1.1 Web Service provider SOADIAGEcho


WebSphere configuration

1. Set PARENT_LAST classloading 2. Add EAR to WebSphere

3. Start the server


11

1.1 Web Service provider SOADIAGEcho


Check Provider is online

Open browser and check that service is exposed at http://localhost:9080/EchoProvider/ws/it/connectivity/00 0039v01

12

1.1 Web Service provider SOADIAGEcho


Summary

To implement a Web Service Provider:


Check the provider is defined in SOAREPO Apply Web Service Facet to the RSA Project Start Web Service Provider Wizard Fill application name Search and select service to implement Check generated code Provide an implementation for the service Configure spring file with URL and service class implementation Check PARENT_LAST policy Deploy to the server and check service is online

13

Roadmap
Table of content

1 Request/Reply Web Service SOADIAG Echo


1.1 Implement a Provider
1.2 Implement a Consumer

2 Publish/Subscribe Web Service SOADIAG Echo Event


2.1 Implement a Publisher

2.2 Implement a Subscriber

14

1.2 Web Service consumer SOADIAGEcho


Setup project

We create a Dynamic Web Project named EchoConsumer and we add Simplicio Web Services Facet

15

1.2 Web Service consumer SOADIAGEcho


Consumer wizard

1. Activate contextual menu on project AFKLM>Web Services>Consumer Wizard 2. Select SOA repository 3. Set Application SOADIAG 4. Press Search 5. Select SoadiagEcho 6. Click on Next

16

1.2 Web Service consumer SOADIAGEcho


Consumer wizard

Set contexteroot as EchoProvider, click twice on Next and once on Finish button

17

1.2 Web Service consumer SOADIAGEcho


Consumer layout

Spring is configured WSDL is copied Code is generated in src-gen

18

1.2 Web Service consumer SOADIAGEcho


Consumer configuration 1. Configure spring with service class generated
"com.afklm.appli.ws.SoadiagEventEchoV10"

2.

Configure WSDL with provider location http://localhost:9080/EchoProvider/ws/it/connectivity/000039v01

19

1.2 Web Service consumer SOADIAGEcho


Consumer service invocation

Write a simple jsp file like the following one:

This is not the normal way to invoke a Web Service in a JSP file since it breaks the struts layout. Moreover it does not handle exceptions.
20

1.2 Web Service consumer SOADIAGEcho


WebSphere configuration

Check that the consumer is configured as PARENT_LAST:

Start WebSphere application server

21

1.2 Web Service consumer SOADIAGEcho


Consumer check

Check that the consumer works http://localhost:9080/EchoConsumer/index.jsp

22

1.2 Web Service consumer SOADIAGEcho


Summary

To implement a Web Service Consumer:


Check the consumer is defined in SOAREPO Apply Web Service Facet to the RSA Project Start Web Service Consumer Wizard Fill application name Search and select service to invoke Check generated code Add code to invoke the service Configure spring file with generated service class Configure spring with service url suffix Check PARENT_LAST policy Deploy to the server and check service is invoked

23

1.2 Web Service consumer SOADIAGEcho


What to do next

Security aspects is not taken into account:


Install credentials (secured jar) Add security policy in WSDL Catch system and business fault

Exception handling is bypassed:

24

Roadmap
Table of content

1 Request/Reply Web Service SOADIAG Echo


1.1 Implement a Provider
1.2 Implement a Consumer

2 Publish/Subscribe Web Service SOADIAG Echo Event


2.1 Implement a Publisher

2.2 Implement a Subscriber

25

2 Publish/Subscribe summary
Reminder

A publish/subscribe Web Service SOADIAGEchoEvent is defined in SOAREPO, we will:


- Provide a publisher of this event - Implement a subscriber of this event

We need:
- Rational Software Architect - Simplicio plugins for Web Services

26

2 Event EDA SOADIAGEchoEvent


Event publisher/subscriber

SOADIAGEchoEvent is an event Web Service, also known as oneway

The same wizard is used for code generation but the semantic is inversed:

Consumer wizard is used to publish a message


Provider wizard is used to subscribe a message

The configuration is slightly different since MQ JMS is used instead of HTTP

27

Roadmap
Table of content

1 Request/Reply Web Service SOADIAG Echo


1.1 Implement a Provider
1.2 Implement a Consumer

2 Publish/Subscribe Web Service SOADIAG Echo Event


2.1 Implement a Publisher

2.2 Implement a Subscriber

28

2.1 Event publisher SOADIAGEchoEvent


Publisher wizard Activate contextual menu on project AFKLM>Web Services>Consumer Wizard Select SOA repository Set Application SOADIAG Press Search Select SoadiagEchoEvent Click on Next

29

2.1 Event publisher SOADIAGEchoEvent


Publisher wizard On next panel select Asynchronous (JMS)

Fill JNDI Queue Name


Fill JNDI Queue Connection Factory name

Click Next twice and press Finish button

30

2.1 Event publisher SOADIAGEchoEvent


Publisher configuration 1. Configure spring JNDI with location of .bindings file

2. Configure spring with service class generated "com.afklm.appli.ws.SoadiagEventEchoV10"

31

2.1 Event publisher SOADIAGEchoEvent


Publisher invocation Event publishing will be similar to:

Spring IOC will be used to avoid NPE with ac


See dinb wiki for details
32

2.1 Event publisher SOADIAGEchoEvent


Summary

To implement a Web Service Event Publisher:


Check the consumer is defined in SOAREPO Apply Web Service Facet to the RSA Project Start Web Service Consumer Wizard Fill application name Search and select service to invoke Select Asynchronous/JMS and fill JMS Queue and QueueConnectionFactory Check generated code Configure spring file with service implementation class Configure spring with JNDI settings Implement you logic code to publish the event Test your publisher with SOAPUI/JMS
33

Roadmap
Table of content

1 Request/Reply Web Service SOADIAG Echo


1.1 Implement a Provider
1.2 Implement a Consumer

2 Publish/Subscribe Web Service SOADIAG Echo Event


2.1 Implement a Publisher

2.2 Implement a Subscriber

34

2.2 Event subscriber SOADIAGEchoEvent


Subscriber wizard Activate contextual menu on project AFKLM>Web Services>Provider Wizard Select SOA repository Set Application SOADIAG Press Search Select SoadiagEchoEvent Click on Next

35

2.2 Event subscriber SOADIAGEchoEvent


Subscriber wizard On next panel select Asynchronous (JMS)

Fill JNDI Queue Name


Fill JNDI Queue Connection Factory name

Click Next twice and press Finish button

36

2.2 Event subscriber SOADIAGEchoEvent


Subscriber implementation Implement the subscriber:
Implement the interface Put @WebService annotation

37

2.2 Event subscriber SOADIAGEchoEvent


Subscriber configuration Configure spring JNDI with location of .bindings file

Configure spring with subscriber class implementation "com.afklm.appli.ws.SoadiagEchoEventImpl"

38

2.2 Event subscriber SOADIAGEchoEvent


Subscriber Summary

To implement a Web Service Event Subscriber:


Check the consumer is defined in SOAREPO Apply Web Service Facet to the RSA Project Start Web Service Provider Wizard Fill application name Search and select service to invoke Select Asynchronous/JMS and fill JMS Queue and QueueConnectionFactory Check generated code Implement code to process the event Configure spring file with subscriber implementation class Configure spring with JNDI settings Test your subscriber with SOAPUI/JMS
39

You might also like