• No results found

Reusing Existing * Java EE Applications from Oracle SOA Suite

N/A
N/A
Protected

Academic year: 2021

Share "Reusing Existing * Java EE Applications from Oracle SOA Suite"

Copied!
59
0
0

Loading.... (view fulltext now)

Full text

(1)

Reusing Existing Java EE *

Applications from Oracle SOA Suite

Guido Schmutz

Technology Manager, Oracle ACE Director for FMW & SOA

Trivadis AG, Switzerland

(2)

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.

(3)

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

(4)

~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

(5)

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

(6)

SOA Suite 11g Product-Architecture

SOA Suite

Oracle Service Bus (OSB) BPEL Business

Rule

Human Workflow

Mediator Spring

Adapter

WebLogic Suite

BPM Suite

BPMN

BPA Suite

BPMN EPK UML

Application Integration Architecture (AIA)

Foundation Pack Process Integration Pack (PIP)

CEP

(7)

SOA Suite 11g Product-Architecture

Unified Runtime

BPMN

Policy Manager Optimized

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 Process Payment

Notify User

Download Video Customer

Customer

Copy to S3 Create and Submit Order Process Payment

Notify User

Download Video Customer

Customer

Copy to S3

BPM Studio

(with Business and IT views)

Shared BPMN Model

Business View BPA

BPMN 2.0, BPEL

Rich End User Interaction Web based customization

Process Composer BPEL

Process Analytics Proc Cubes

Spring

(8)

Integration Blueprint

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

(9)

Principles of Service-Orientation

(10)

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

(11)

SOA vs. WOA

SOAP-based Services

REST Service

(12)

Simple Use Case

 Customer Service Interface in Java

 Customer and Address DTO

(13)

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

(14)

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)

(15)

Web Applications

 Servlet, JSP, POJO

XML over HTTP

HTML over HTTP

(16)

Java EE Applications and Messaging

 Session Bean, Entity Bean, Message Driven Bean, POJO

RMI/IIOP

RMI/IIOP

HTML over HTTP

JMS Messaging

(17)

Spring Applications and Messaging

 Spring POJO, JMS Message Listener, Remoting through Exporters

XML over HTTP

HTML over HTTP

Spring JMS Abstraction

(18)

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

(19)

Service Enabling Java EE Application

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

SOAP

REST

HTML over HTTP

XML over HTTP

(20)

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

(21)

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 annotations that allow you to build and consume web services with Java

 depends on other specifications such as Java

Architecture for XML Binding (JAXB).

(22)

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

(23)

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

(24)

JAX-WS - Code First

Determines XSD

Determines WSDL

(25)

JAX-WS - Code First



WSDL and XSD generated

(26)

JAX-WS – Code First

(27)

JAX-WS –

WSDL First

(28)

JAX-WS – WSDL First

(29)

JAX-WS – WSDL First

Transformation

JAXB Annotations JAX-WS Annotations

EJB Annotations

(30)

JAX-WS – WSDL First

(31)

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)

(32)

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

(33)

JAX-RS for RESTful Services

POJO with JAXB Annotations

Session Bean or POJO with JAX-RS

(34)

JAX-RS for RESTful Services

(35)

Service Enabling Spring Application

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

SOAP

REST

XML over HTTP

HTML over HTTP SOAP

(36)

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

(37)

Service Enabling Web Applications

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

SOAP

REST

HTML over HTTP

XML over HTTP SOAP

(38)

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

(39)

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

(40)

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

(41)

OSB HTTP Transport to wrap JAX- WS Code First service

Proxy Service

XQuery Transformation

Business Service with HTTP Transport

Transformation

(42)

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

(43)

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

(44)

OSB EJB Transport to call EJB

Proxy Service Business Service with EJB Transport

(45)

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

(46)

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

(47)

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

(48)

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

(49)

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

(50)

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

(51)

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

(52)

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

(53)

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

(54)

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

(55)

Using the SCA Spring component

(56)

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

(57)

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

(58)

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

(59)

Reusing Existing Java EE

Applications from Oracle SOA Suite

Please Fill Out Your Evaluations

Guido Schmutz

Technology Manager, Oracle ACE Director for FMW & SOA

Trivadis AG, Switzerland

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

References

Related documents