reusing existing java ee applications from oracle soa suite

59
* Reusing Existing Java EE Applications from Oracle SOA Suite Guido Schmutz Technology Manager, Oracle ACE Director for FMW & SOA Trivadis AG, Switzerland

Upload: buikiet

Post on 31-Dec-2016

237 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Reusing Existing Java EE Applications from Oracle SOA Suite

*Reusing Existing Java EE Applications from Oracle SOA Suite

Guido SchmutzTechnology Manager, Oracle ACE Director for FMW & SOATrivadis AG, Switzerland

Page 2: Reusing Existing Java EE Applications from Oracle SOA Suite

Abstract

� You have a lot of existing Java EE applications. Part of these applications and their logic have a potential to be reused in an SOA. But what is the best practice for reusing such Java EE applications? This session will show different approaches available with SOA Suite 11g in the SCA assembly model as well as with the Oracle Service Bus to reuse existing Java EE artifacts.

Page 3: Reusing Existing Java EE Applications from Oracle SOA Suite

Guido Schmutz

� Working for Trivadis for more than 14 years� Oracle ACE Director for Fusion Middleware and SOA� Co-Author of different books� Consultant, Trainer Software Architect for Java, Oracle,

SOA and EDA� Member of Trivadis Architecture Board� Technology Manager @ Trivadis

� More than 20 years of software development experience

� Contact: [email protected]� Blog: http://guidoschmutz.wordpress.com� Twitter: gschmutz

Page 4: Reusing Existing Java EE Applications from Oracle SOA Suite

~350 employees

~180 employees

~20 employees

Trivadis Facts & Figures

� 11 Trivadis locations with more than 550 employees

� Financially independent and sustainably profitable

� Key figures 2010

● Revenue CHF 101 / EUR 73 mio.

● Services for more than 700 clients in over 1‘800 projects

● Over 170 Service Level Agreements

● More than 5'000 training participants

● Research and development budget: CHF 5.0 / EUR 3.6 mio

Page 5: Reusing Existing Java EE Applications from Oracle SOA Suite

Agenda

� Introduction� What kind of Java EE architectures can we

find today?� Service Enabling on the Java Layer� Service Enabling on the Oracle Service Bus� Service Enabling in Oracle SOA Suite� Best Practices and Summary

Page 6: Reusing Existing Java EE Applications from Oracle SOA Suite

SOA Suite 11g Product-Architecture

SOA Suite

Oracle Service Bus (OSB)

BPEL BusinessRule

HumanWorkflow

Mediator Spring

Adapter

WebLogic Suite

BPM Suite

BPMN

BPA Suite

BPMN EPK UML

Application Integration Architecture (AIA)

Foundation Pack Process Integration Pack (PIP)

CEP

Page 7: Reusing Existing Java EE Applications from Oracle SOA Suite

SOA Suite 11g Product-Architecture

Unified Runtime

BPMN

Policy ManagerOptimized

binding

Human Human Workflow

(+AMX, AG, Orgn)

Business Rules

Oracle Service Bus

Common JCA-based connectivity infrastructure

Repository

EM console+BPMN Screens

BAM

B2B

Mediator

Workspace Process Portal(WC spaces)

MS Office

Create and Submit Order

ProcessPayment

NotifyUser

DownloadVideoCustomer

Customer

Copy toS3

Create and Submit Order

ProcessPayment

NotifyUser

DownloadVideoCustomer

Customer

Copy toS3

BPM Studio(with Business and IT views)

Shared BPMN Model

Business View

BPA

BPMN 2.0, BPEL

Rich End User InteractionWeb based customization

Process Composer

BPEL

ProcessAnalytics

Proc Cubes

Spring

Page 8: Reusing Existing Java EE Applications from Oracle SOA Suite

Integration Blueprint

http://www.packtpub.com/article/trivadis-integration-architecture-blueprint

Page 9: Reusing Existing Java EE Applications from Oracle SOA Suite

Principles of Service -Orientation

Page 10: Reusing Existing Java EE Applications from Oracle SOA Suite

Contract-First Web Service Design

� Important for service-orientation is the standardizing and decoupling of the technical contract of each service

� Service-oriented design therefore should be based on a contract first approach● avoid the use of auto-

generation tools Source: Thomas Erl, Principles of Service Design

Page 11: Reusing Existing Java EE Applications from Oracle SOA Suite

SOA vs. WOA

SOAP-based Services

REST Service

Page 12: Reusing Existing Java EE Applications from Oracle SOA Suite

Simple Use Case

� Customer Service Interface in Java

� Customer and Address DTO

Page 13: Reusing Existing Java EE Applications from Oracle SOA Suite

Agenda

� Introduction� What kind of Java EE architectures can we

find today?� Service Enabling on the Java Layer� Service Enabling on the Oracle Service Bus� Service Enabling in Oracle SOA Suite� Best Practices and Summary

Page 14: Reusing Existing Java EE Applications from Oracle SOA Suite

Kind of Java EE architectures

� Web Applications● Servlet, JSP, JSF, POJO● With XML over HTTP – pre RESTful

� Spring Applications with/without Messaging● POJO, Fat-Client, Client/Server, N-Tier● Spring JMS, Spring Integration, Apache Camel

� EJB (3) Applications with/without Messaging● Session Bean, Entity Bean● Message Driven Bean (MDB)

Page 15: Reusing Existing Java EE Applications from Oracle SOA Suite

Web Applications

� Servlet, JSP, POJO

XML overHTTP

HTML overHTTP

Page 16: Reusing Existing Java EE Applications from Oracle SOA Suite

Java EE Applications and Messaging

� Session Bean, Entity Bean, Message Driven Bean, POJO

RMI/IIOP

RMI/IIOP

HTML over HTTP

JMS Messaging

Page 17: Reusing Existing Java EE Applications from Oracle SOA Suite

Spring Applications and Messaging

� Spring POJO, JMS Message Listener, Remoting through Exporters

XML over HTTP

HTML over HTTP

Spring JMS Abstraction

Page 18: Reusing Existing Java EE Applications from Oracle SOA Suite

Agenda

� Introduction� What kind of Java EE architectures can we

find today?� Service Enabling on the Java Layer� Service Enabling on the Oracle Service Bus� Service Enabling in Oracle SOA Suite� Best Practices and Summary

Page 19: Reusing Existing Java EE Applications from Oracle SOA Suite

Service Enabling Java EE Application

� Using JAX-WS for SOAP- and JAX-RS for RESTful-WebServices

SOAP

REST

HTML over HTTP

XML over HTTP

Page 20: Reusing Existing Java EE Applications from Oracle SOA Suite

2 Types of Web Services in Java EE 6

� SOAP-based Web Services● Provided by JAX-WS ● aka. “Big” Web Services (Java EE 6 Tutorial)

� RESTful Web Services● Provided by JAX-RS

Page 21: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS for Web Services

� Since Java EE 5, JAX-WS (JSR 224) the preferred technology to write SOAP web services

� Prior was JAX-RPC 1.0 (JSR 101)● has been pruned in Java EE 6, meaning that it is proposed

to be removed from Java EE 7.

� JAX-WS 2.2 defines a set of APIs and annotationsthat allow you to build and consume web services with Java

� depends on other specifications such as Java Architecture for XML Binding (JAXB).

Page 22: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS for Web Services

� Web services rely on the configuration by exception paradigm (like most of new Java EE specs)

� Only one annotation is needed to turn a POJO into a web service● The class must be annotated with @WebService or the

XML equivalent in a deployment descriptor.

� To turn a web service into an EJB endpoint, the class has to be annotated with @Stateless

Page 23: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS for Web Services

� Code First (bottom-up) => contract-last● write the Java classes and the data POJOs representing the

service (operations and data types)● Use JAX-WS to generate the WSDL and XML schema types. ● often referred to as Java-to-WSDL

� WSDL First (top-down) => contract-first● Create WSDL and XML schemas manually● Use JAX-WS tools to generate the Java interface and the data

POJOs● Implement the generated Java interface through a Java class● often referred to as WSDL-to-Java

Page 24: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS - Code First

Determines XSD

Determines WSDL

Page 25: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS - Code First

� WSDL and XSD generated

Page 26: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS – Code First

Page 27: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS –WSDL First

Page 28: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS – WSDL First

Page 29: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS – WSDL First

Transformation

JAXB Annotations

JAX-WS Annotations

EJB Annotations

Page 30: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS – WSDL First

Page 31: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-WS - Conclusion

Code First

● Easy to get with just a few annotations

● No control / minimal control over WSDL / XSD

● No Contract-First design● Difficult to govern● Do not let your consumers

access it directly● Apply Legacy Wrapper pattern

(i.e. on OSB)

WSDL First

● Full control over WSDL / XSD● More work● Additional transformation layer

needed, might already have● DB-to-Entity (JPA)● Entity-to-DTO (Java)

Page 32: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-RS for RESTful Services

� relies heavily on annotations, similar to JAX-WS to specify URI mappings, HTTP headers, content-types and resources

� POJO-based� HTTP-centric� Format Independence� Container Independence

Page 33: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-RS for RESTful Services

POJO with JAXB Annotations

Session Bean or POJO with JAX-RS

Page 34: Reusing Existing Java EE Applications from Oracle SOA Suite

JAX-RS for RESTful Services

Page 35: Reusing Existing Java EE Applications from Oracle SOA Suite

Service Enabling Spring Application

� Using Spring WS for SOAP- and Spring Web for Restful-WebServices

SOAP

REST

XML over HTTP

HTML over HTTP

SOAP

Page 36: Reusing Existing Java EE Applications from Oracle SOA Suite

Spring -WS

� Spring-WS is a part of Spring focused on creating document-driven Web Services

� Supports only contract-first SOAP service development� Based on Spring itself and its concepts, like dependency

injection� Key features

● Powerful mappings● XML API support (DOM, SAX, StAX, JDOM)● Flexible XML Marshalling (JAXB 1 and 2, Castor,

XMLBeans, XStream)● Supports WS-Security (integrates with Spring Security)● Build by Maven

Page 37: Reusing Existing Java EE Applications from Oracle SOA Suite

Service Enabling Web Applications

� Using Spring WS for SOAP- and Spring Web for Restful-WebServices

SOAP

REST

HTML over HTTP

XML over HTTP

SOAP

Page 38: Reusing Existing Java EE Applications from Oracle SOA Suite

Agenda

� Introduction� What kind of Java EE architectures can we

find today?� Service Enabling on the Java Layer� Service Enabling on the Oracle Service Bus� Service Enabling in Oracle SOA Suite� Best Practices and Summary

Page 39: Reusing Existing Java EE Applications from Oracle SOA Suite

Service Enabling on Oracle Service Bus

With Web Services in Java

● Calling SOAP Web Services through HTTP transport

● Calling Restful WebServices through HTTP Transport

Without Web Services in Java

● EJB Transport● In same transaction

● Using HTTP Transport to talk to XML over HTTP

● Using JMS transport to send message to MDB● With WS interface

● Integrate directly with the underlying database

● Custom Transport/JCA● Screen scraping, i.e. reuse

existing HTML

Page 40: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB HTTP Transport to wrap JAX -WS Code First service

Problem● Want to offer a contract-first SOAP-based Web Service to consumers and

not the JAX-WS service

Solution● Use OSB HTTP Transport to wrap the JAX-WS Code-First service● Provide it as a contract-first SOAP web service on OSB

SOAP Webservice

Transform from/to canonical model

Page 41: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB HTTP Transport to wrap JAX -WS Code First service

Proxy Service

XQuery Transformation

Business Service with HTTP Transport

Transformation

Page 42: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB HTTP Transport to wrap JAX -RS service

Problem● Want to make a REST Web Service available on the OSB as a contract-

first SOAP-based Web Service

Solution● Use the OSB HTTP Transport to invoke REST Web Service ● Provide it as a contract-first SOAP web service on OSB

REST Webservice

Page 43: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB EJB Transport to call EJB

Problem● Want to use an EJB session bean directly without having to service

enable it first

Solution● Use OSB EJB Transport to access the existing EJB session bean● Provide it as a contract-first SOAP web service on OSB

RMI / IIOP

Transaction propagation

Page 44: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB EJB Transport to call EJB

Proxy Service Business Service with EJB Transport

Page 45: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB HTTP Transport to call XML / HTTP functionality

Problem● Want to make an XML over HTTP functionality available as a contract-first

style Web Service

Solution● Use OSB HTTP Transport to call the XML over HTTP “service”● transform the information to/from the service contract● Provide it as a contract-first SOAP web service on OSB

XML over HTTP

Page 46: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB JMS transport to send message to Queue/Topic

Problem● want to send a message in to a Queue/Topic consumed by an existing

application (i.e. MDB)

Solution● Use the OSB JMS Transport to enqueue message● offer that operation as a service to potential consumers (i.e. SOAP-based WS)

JMS Enqueue

Page 47: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB JMS transport to consume message from Queue/Topic

Problem● want to consume a message from a Queue/Topic which is sent/published by

an existing application

Solution● Use OSB JMS Transport to dequeue message● inform interested application(s) by calling a service (i.e. SOAP-based WS)

JMS Dequeue

Page 48: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB and DB Adapter for request-driven access to information

Problem● Want to directly access data from DB of an existing Java application

Solution● Use the DB Adapter on the OSB to implement CRUD DB operations● Provide it as a contract-first SOAP web service on OSB

SQL

Page 49: Reusing Existing Java EE Applications from Oracle SOA Suite

OSB and DB Adapter for event-driven notification of changes

Problem● Want to have an event-driven push of a message , when something

changes in an existing system and inform interested systems

Solution● Use the DB Adapter to poll a DB table for changes● use OSB to send notification messages to interested parties (subscribers)

SQL polling

Page 50: Reusing Existing Java EE Applications from Oracle SOA Suite

HTTP Transport to reuse existing HTML user interface (screen scraping)

Problem● Only interface available is a Web application with an HTML user

interface . Want to reuse that and make it available as a Web Service?

Solution● Use OSB HTTP Transport to invoke the HTML interface● extract the data out of the presentation logic (HTML) ● Provide it as a contract-first SOAP web service on OSB

HTML over HTTP

Page 51: Reusing Existing Java EE Applications from Oracle SOA Suite

Agenda

� Introduction� What kind of Java EE architectures can we

find today?� Service Enabling on the Java Layer� Service Enabling on the Oracle Service Bus� Service Enabling in Oracle SOA Suite� Best Practices and Summary

Page 52: Reusing Existing Java EE Applications from Oracle SOA Suite

Service Enabling on Oracle SOA Suite

� Similar integration as on OSB● EJB Adapter● Web Service Adapter to invoke an existing Web Service● Socket Adapter● JMS adapter to send message to MDB

� SCA specific integration of● Java using Spring component (if available as library)● Java Callout in Mediator● SDO Service● Reuse OSB service through SOA-Direct transport

Page 53: Reusing Existing Java EE Applications from Oracle SOA Suite

Using SOA -Direct adapter to invoke an OSB service

Problem● Want to reuse an OSB services efficiently from a SOA Suite component

Solution● use SOA Direct adapter call OSB service● Use it from any other component within the SCA composite

SOA Direct

Page 54: Reusing Existing Java EE Applications from Oracle SOA Suite

Using the SCA Spring component

Problem● Want to reuse Java code based on a Java archive (JAR)

Solution● Use the SCA Spring Component within an SCA composite to invoke a

Spring application from any other SCA component● Use it from any other component within the SCA composite

Page 55: Reusing Existing Java EE Applications from Oracle SOA Suite

Using the SCA Spring component

Page 56: Reusing Existing Java EE Applications from Oracle SOA Suite

Agenda

� Introduction� What kind of Java EE architectures can we

find today?� Service Enabling on the Java Layer� Service Enabling on the Oracle Service Bus� Service Enabling in Oracle SOA Suite� Best Practices and Summary

Page 57: Reusing Existing Java EE Applications from Oracle SOA Suite

Summary

� Never publish a contract-last service contract directly to consumers● Hide it by putting an OSB or Mediator service in between● Use a contract-first approach on the interface of the OSB / Mediator

service

� OSB provides an easy intermediary layer for service-enabling existing Java EE EJB applications● With additional benefit of advanced mediator features like Throttling,

Service Pooling, Transformation, Validation, Enrichment, Split/Join

� Use the OSB EJB transport to integrate EJB● Transaction can be propagated to the EJB layer

Page 58: Reusing Existing Java EE Applications from Oracle SOA Suite

My other sessions @ Kscope11

� Fault Handling in Oracle SOA Suite 11g , Wednesday 8:30 – 9:30 Room 203C

� Best Practices for Designing and Building the Services of a SOA , Wednesday 9:45 –10:45 Room 203C

Page 59: Reusing Existing Java EE Applications from Oracle SOA Suite

Reusing Existing Java EE Applications from Oracle SOA Suite

Please Fill Out Your Evaluations

Guido SchmutzTechnology Manager, Oracle ACE Director for FMW & SOATrivadis AG, Switzerland

Feedback-URL: http://ezsession.com/kscope