simpliciowebservicedemo[1]
TRANSCRIPT
-
8/2/2019 SimplicioWebServiceDemo[1]
1/39
Simplicio plugin for Web ServicesHow to implement a Web Serviceprovider/consumer with Rational SoftwareArchitect ?
Version 2.0 07/06/2010
-
8/2/2019 SimplicioWebServiceDemo[1]
2/39
2
RoadmapTable of content
1 Request/Reply Web Service SOADIAG Echo
1.1 Implement a Provider
1.2 Implement a Consumer
2 Publish/Subscribe Web Service SOADIAGEcho Event
2.1 Implement a Publisher 2.2 Implement a Subscriber
-
8/2/2019 SimplicioWebServiceDemo[1]
3/39
3
1 Request/Reply summaryReminder
A request/reply Web Service SOADIAGEcho is defined inSOAREPO, we will:
- Provide an implementation of this service
- Implement a consumer of this service
We need:- Rational Software Architect
- Simplicio plugins for Web Services
-
8/2/2019 SimplicioWebServiceDemo[1]
4/39
4
RoadmapTable of content
1 Request/Reply Web Service SOADIAG Echo
1.1 Implement a Provider
1.2 Implement a Consumer
2 Publish/Subscribe Web Service SOADIAGEcho Event
2.1 Implement a Publisher 2.2 Implement a Subscriber
-
8/2/2019 SimplicioWebServiceDemo[1]
5/39
5
1.1 Web Service provider SOADIAGEchoSetup project
We create a Dynamic Web Project named EchoProviderand we add Simplicio Web Services Facet
-
8/2/2019 SimplicioWebServiceDemo[1]
6/39
6
1.1 Web Service provider SOADIAGEchoProvider Wizard
1. Activate contextual menu on project AFKLM>WebServices>Provider Wizard
2. Select SOA repository
3. Set Application SOADIAG
4. Press Search
5. Select SoadiagEcho
6. Click on Next
-
8/2/2019 SimplicioWebServiceDemo[1]
7/39
7
1.1 Web Service provider SOADIAGEchoProvider Wizard
Click twice on Next and once on Finish button
-
8/2/2019 SimplicioWebServiceDemo[1]
8/39
8
1.1 Web Service provider SOADIAGEchoProvider layout
Spring is configured
WSDL is copied
Code is generated in src-gen
-
8/2/2019 SimplicioWebServiceDemo[1]
9/39
9
1.1 Web Service provider SOADIAGEchoProvider implementation
Implement the provider:Implement the interface
Put @WebService annotation
-
8/2/2019 SimplicioWebServiceDemo[1]
10/39
10
1.1 Web Service provider SOADIAGEchoProvider configuration
Update the spring configuration file and set:- url as "/ws/it/connectivity/000039v01"
- Service implementation class as"com.afklm.soadiag.ws.echo.EchoServiceImpl"
-
8/2/2019 SimplicioWebServiceDemo[1]
11/39
11
1.1 Web Service provider SOADIAGEchoWebSphere configuration
1. Set PARENT_LASTclassloading
2. Add EAR to WebSphere
3. Start the server
-
8/2/2019 SimplicioWebServiceDemo[1]
12/39
12
1.1 Web Service provider SOADIAGEchoCheck Provider is online
Open browser and check that service is exposed athttp://localhost:9080/EchoProvider/ws/it/connectivity/000039v01
-
8/2/2019 SimplicioWebServiceDemo[1]
13/39
13
1.1 Web Service provider SOADIAGEchoSummary
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 classimplementation
Check PARENT_LAST policy
Deploy to the server and check service is online
-
8/2/2019 SimplicioWebServiceDemo[1]
14/39
14
RoadmapTable of content
1 Request/Reply Web Service SOADIAG Echo
1.1 Implement a Provider
1.2 Implement a Consumer
2 Publish/Subscribe Web Service SOADIAGEcho Event
2.1 Implement a Publisher 2.2 Implement a Subscriber
-
8/2/2019 SimplicioWebServiceDemo[1]
15/39
15
1.2 Web Service consumer SOADIAGEchoSetup project
We create a Dynamic Web Project named EchoConsumerand we add Simplicio Web Services Facet
-
8/2/2019 SimplicioWebServiceDemo[1]
16/39
16
1.2 Web Service consumer SOADIAGEchoConsumer wizard
1. Activate contextual menu on project AFKLM>WebServices>Consumer Wizard
2. Select SOA repository
3. Set Application SOADIAG
4. Press Search
5. Select SoadiagEcho
6. Click on Next
-
8/2/2019 SimplicioWebServiceDemo[1]
17/39
17
1.2 Web Service consumer SOADIAGEchoConsumer wizard
Set contexteroot as EchoProvider, click twice on Next andonce on Finish button
-
8/2/2019 SimplicioWebServiceDemo[1]
18/39
18
1.2 Web Service consumer SOADIAGEchoConsumer layout
Spring is configured
WSDL is copied
Code is generated in src-gen
-
8/2/2019 SimplicioWebServiceDemo[1]
19/39
19
1.2 Web Service consumer SOADIAGEchoConsumer configuration
1. Configure spring with service class generated"com.afklm.appli.ws.SoadiagEventEchoV10"
2. Configure WSDL with provider locationhttp://localhost:9080/EchoProvider/ws/it/connectivity/000039v01
-
8/2/2019 SimplicioWebServiceDemo[1]
20/39
20
1.2 Web Service consumer SOADIAGEchoConsumer service invocation
Write a simple jsp file like the following one:
This is not the normal way to invoke a Web Service in aJSP file since it breaks the struts layout.
Moreover it does not handle exceptions.
-
8/2/2019 SimplicioWebServiceDemo[1]
21/39
21
1.2 Web Service consumer SOADIAGEchoWebSphere configuration
Check that the consumer is configured as PARENT_LAST:
Start WebSphere application server
-
8/2/2019 SimplicioWebServiceDemo[1]
22/39
22
1.2 Web Service consumer SOADIAGEchoConsumer check
Check that the consumer workshttp://localhost:9080/EchoConsumer/index.jsp
-
8/2/2019 SimplicioWebServiceDemo[1]
23/39
23
1.2 Web Service consumer SOADIAGEchoSummary
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
-
8/2/2019 SimplicioWebServiceDemo[1]
24/39
24
1.2 Web Service consumer SOADIAGEchoWhat to do next
Security aspects is not taken into account: Install credentials (secured jar)
Add security policy in WSDL
Exception handling is bypassed:
Catch system and business fault
-
8/2/2019 SimplicioWebServiceDemo[1]
25/39
25
RoadmapTable of content
1 Request/Reply Web Service SOADIAG Echo
1.1 Implement a Provider
1.2 Implement a Consumer
2 Publish/Subscribe Web Service SOADIAGEcho Event
2.1 Implement a Publisher 2.2 Implement a Subscriber
-
8/2/2019 SimplicioWebServiceDemo[1]
26/39
26
2 Publish/Subscribe summaryReminder
A publish/subscribe Web Service SOADIAGEchoEvent isdefined 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
-
8/2/2019 SimplicioWebServiceDemo[1]
27/39
27
2 Event EDA SOADIAGEchoEventEvent publisher/subscriber
SOADIAGEchoEvent is an event Web Service, also knownas 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 isused instead of HTTP
-
8/2/2019 SimplicioWebServiceDemo[1]
28/39
28
RoadmapTable of content
1 Request/Reply Web Service SOADIAG Echo
1.1 Implement a Provider
1.2 Implement a Consumer
2 Publish/Subscribe Web Service SOADIAGEcho Event
2.1 Implement a Publisher 2.2 Implement a Subscriber
-
8/2/2019 SimplicioWebServiceDemo[1]
29/39
29
2.1 Event publisher SOADIAGEchoEventPublisher wizard
Activate contextual menuon project AFKLM>WebServices>ConsumerWizard
Select SOA repository
Set Application SOADIAG
Press Search
Select SoadiagEchoEvent
Click on Next
-
8/2/2019 SimplicioWebServiceDemo[1]
30/39
30
2.1 Event publisher SOADIAGEchoEventPublisher wizard
On next panel selectAsynchronous (JMS)
Fill JNDI Queue Name
Fill JNDI Queue
Connection Factory name
Click Next twice and pressFinish button
-
8/2/2019 SimplicioWebServiceDemo[1]
31/39
31
2.1 Event publisher SOADIAGEchoEventPublisher configuration
1. Configure spring JNDI with location of .bindings file
2. Configure spring with service class generated"com.afklm.appli.ws.SoadiagEventEchoV10"
-
8/2/2019 SimplicioWebServiceDemo[1]
32/39
32
2.1 Event publisher SOADIAGEchoEventPublisher invocation
Event publishing will be similar to:
Spring IOC will be used to avoid NPE with ac
See dinb wiki for details
http://wiki-dinb.airfrance.fr/http://wiki-dinb.airfrance.fr/ -
8/2/2019 SimplicioWebServiceDemo[1]
33/39
33
2.1 Event publisher SOADIAGEchoEventSummary
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 andQueueConnectionFactory
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
-
8/2/2019 SimplicioWebServiceDemo[1]
34/39
34
RoadmapTable of content
1 Request/Reply Web Service SOADIAG Echo
1.1 Implement a Provider
1.2 Implement a Consumer
2 Publish/Subscribe Web Service SOADIAGEcho Event
2.1 Implement a Publisher 2.2 Implement a Subscriber
-
8/2/2019 SimplicioWebServiceDemo[1]
35/39
35
2.2 Event subscriber SOADIAGEchoEventSubscriber wizard
Activate contextual menuon project AFKLM>WebServices>Provider Wizard
Select SOA repository
Set Application SOADIAG Press Search
Select SoadiagEchoEvent
Click on Next
-
8/2/2019 SimplicioWebServiceDemo[1]
36/39
36
2.2 Event subscriber SOADIAGEchoEventSubscriber wizard
On next panel selectAsynchronous (JMS)
Fill JNDI Queue Name
Fill JNDI Queue
Connection Factory name
Click Next twice and pressFinish button
-
8/2/2019 SimplicioWebServiceDemo[1]
37/39
37
2.2 Event subscriber SOADIAGEchoEventSubscriber implementation
Implement the subscriber:Implement the interface
Put @WebService annotation
-
8/2/2019 SimplicioWebServiceDemo[1]
38/39
38
2.2 Event subscriber SOADIAGEchoEventSubscriber configuration
Configure spring JNDI with location of .bindings file
Configure spring with subscriber class implementation"com.afklm.appli.ws.SoadiagEchoEventImpl"
-
8/2/2019 SimplicioWebServiceDemo[1]
39/39
39
2.2 Event subscriber SOADIAGEchoEventSubscriber 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 andQueueConnectionFactory
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