reusing existing java ee applications from oracle soa suite

Post on 31-Dec-2016

230 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

*Reusing Existing Java EE Applications from Oracle SOA Suite

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

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.

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: guido.schmutz@trivadis.com� Blog: http://guidoschmutz.wordpress.com� Twitter: gschmutz

~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

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

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

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

Integration Blueprint

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

Principles of Service -Orientation

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

SOA vs. WOA

SOAP-based Services

REST Service

Simple Use Case

� Customer Service Interface in Java

� Customer and Address DTO

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

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)

Web Applications

� Servlet, JSP, POJO

XML overHTTP

HTML overHTTP

Java EE Applications and Messaging

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

RMI/IIOP

RMI/IIOP

HTML over HTTP

JMS Messaging

Spring Applications and Messaging

� Spring POJO, JMS Message Listener, Remoting through Exporters

XML over HTTP

HTML over HTTP

Spring JMS Abstraction

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

Service Enabling Java EE Application

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

SOAP

REST

HTML over HTTP

XML over HTTP

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

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).

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

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

JAX-WS - Code First

Determines XSD

Determines WSDL

JAX-WS - Code First

� WSDL and XSD generated

JAX-WS – Code First

JAX-WS –WSDL First

JAX-WS – WSDL First

JAX-WS – WSDL First

Transformation

JAXB Annotations

JAX-WS Annotations

EJB Annotations

JAX-WS – WSDL First

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)

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

JAX-RS for RESTful Services

POJO with JAXB Annotations

Session Bean or POJO with JAX-RS

JAX-RS for RESTful Services

Service Enabling Spring Application

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

SOAP

REST

XML over HTTP

HTML over HTTP

SOAP

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

Service Enabling Web Applications

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

SOAP

REST

HTML over HTTP

XML over HTTP

SOAP

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

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

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

OSB HTTP Transport to wrap JAX -WS Code First service

Proxy Service

XQuery Transformation

Business Service with HTTP Transport

Transformation

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

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

OSB EJB Transport to call EJB

Proxy Service Business Service with EJB Transport

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

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

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

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

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

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

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

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

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

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

Using the SCA Spring component

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

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

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

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

top related