Top Banner
SOPERA GmbH Nur für den internen Gebrauch REST and SOAP Services with Apache CXF Andrei Shakirin, Talend [email protected] ashakirin.blogspot.com/
29

REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

Mar 20, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

REST and SOAP Services with Apache CXF

Andrei Shakirin, Talend

[email protected]/

Page 2: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

Agenda

� Introduction in Apache CXF

� New CXF features

� Project using Apache CXF

� How CXF community works?

2

Page 3: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

Background

� Software architect in Talend Team

� Committer in Apache CXF and Syncope projects

� Speaker for Apache and SOA conferences

� Member of OASIS S-Ramp Group

3

Page 4: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

� Apache Project since 2006

� Basis: Celtix (ObjectWeb), XFire (Codehaus)

� 7 major versions, 58 patch releases

� 33 committers (17 active)

4

CXF History

� Apache: Camel, ServiceMix, Syncope

� JBoss JAX-WS stack

� TomEE JAX-WS and JAX-RS stacks

� Talend, Fusesource, MuleSoft, WSO2

� ‘CXF – Services List‘: Google Adwords, TomTom, …

Who uses CXF?

Page 5: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

Alternatives:

� Axis 2

� Metro

� Jersey

� …

5

Why CXF?

CXF Benefits:

� Strong standards support

� SOAP & Rest services

� Security

� Streaming and performance

� Flexibility

� Large and active community

Page 6: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

Standards Support

6

� JAX-WS 2.2, JAX-RS 1.1, 2.0 (TCK tests)

� Basic support: WS-I Basic Profile

� Metadata: WS-Policy, WSDL 1.1

� Messaging: WS-Addressing, SOAP 1.1/1.2, MTOM

� Security: WS-Security, WS-SecurityPolicy, SAML, WS-Trust, WS-Notification, OAuth 2.0

� Quality of Service: WS-ReliableMessaging

Page 7: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

7

CXF Architecture

Page 8: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

CXF Frontends

1. JAX-WS 2.2

� Contract first (WSDL); code first

� Java; Spring; Blueprint based

� Untyped (Dispatch<>, Provider<>)

� Dynamic client

2. JAX-RS 1.1, 2.0

� Contract first (WADL); code first

� Java; Spring; Blueprint based

8

Page 9: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

Interceptors Chain

9

Page 10: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

Docum

ent Id

entifie

r

Phase Interceptors

10

Business code (PRE/POST/_INVOKE, PRE/USER/POST/_LOGICAL)

Umarshalling/Marshalling (MARSHAL)

Protocol processing (PRE/USER/POST/_PROTOCOL, WRITE)

Stream processing (PRE/USER/POST/STREAM)

Transport (SEND)

Outgoing Chain

Transport (RECIEVE)

Stream processing (PRE/USER/POST/STREAM)

Protocol processing (PRE/USER/POST/_PROTOCOL, READ)

Umarshalling/Marshalling (UNMARSHAL)

Business code (PRE/POST/_INVOKE, PRE/USER/POST/_LOGICAL)

IncomingChain

Page 11: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

11

public class SampleInInterceptor extends AbstractPhaseInterceptor<Message> {

public AttachmentInInterceptor() {

super(Phase.RECEIVE);

getAfter().add(SomeOtherInterceptor.class.getName());

}

public void handleMessage(Message message) {

// Process message

}

public void handleFault(Message messageParam) {

// Process fault

}

}

Sample Interceptor

Page 12: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

CXF Interceptors: Configuration

12

1. Programmatically

MyInterceptor myInterceptor = new MyInterceptor();FooService client = ... ; // created from generated JAX-WS client Client cxfClient = ClientProxy.getClient(client); cxfClient.getInInterceptors().add(myInterceptor);

2. Using Spring/Blueprint configuration

<jaxws:endpoint xmlns:tns="http://wsdl.first.soa.symposium/"implementor="#HelloWorldService" endpointName="tns:HelloWorldServiceEndpoint"serviceName="tns:HelloWorldService" address="http://localhost:8888/HelloWorld">

<jaxws:inInterceptors><bean class="demo.interceptor.MyInterceptor" />

</jaxws:inInterceptors></jaxws:endpoint>

3. Dynamically using WS-Policy

4. Features

Page 13: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

CXF Security

� Authentication (HTTP basic, UsernameToken, X500, Kerberos); WS-Trust 1.4: STS, SAML 2.0; JAAS

� Authorization (SimpleAuthorizingInterceptor, XACML*)

� Encrypt message and parts of message

� Sign message and message elements

� Timestamp message

� WS-SecurityPolicy: bindings, IssuedToken

� PKI support: XKMS service

� Transport level security

13

Page 14: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

CXF Security: Security Token Service

14

Page 15: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

CXF Security: Security Token Service (2.5.x)

15

Page 16: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

CXF Security: XKMS (3.0.0)

16

Page 17: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

CXF Security: XKMS

17

Page 18: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

CXF Security: Rest Security

� Transport level security – SSL

� OAuth 1.0, 2.0

� Handled by App Server, Spring Security framework: customization

� XML message protection

� Propritary extensions: SAML based authentication

� Fediz project (WS-Federation Passive Requestor profile)

18

Page 19: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

CXF Security: Fediz Subproject

Page 20: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

� Standalone

� JEE (Servlet Container): Tomcat, JBoss, Glassfish, ...

� JEE (JCA): JBoss, WebSphere, WebLogic, ...

� OSGi: Equinox, ApacheFelix, Karaf

20

CXF Deployment

Version 2.6:

1. CXF is splitted to different OSGi bundles

2. Configuration Admin: work queues, keystores, http conduits

Page 21: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Nur für den internen Gebrauch

Docum

ent Id

entifie

r

� WSS4J 2.0

� Certified JAX-RS 2.0

� XKMS 2.0

� WS-Eventing

� Internal refactorings and simplificationts

21

CXF 3.0.0

Page 22: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

Custom Project: Rudi

22

Idea: Dynamic multi-domain SOAP/Rest Services Platform

for navigation and cartography purposes (military area)

Team: 5 persons

Terms: January 2011 – Mai 2012

Methodology: Scrum

Customer: IABG

Page 23: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

Custom Project: Rudi

23

Requirements:

� Dynamic service resolving based on WS-Policy

� SAML based federated authentication

� Role based authorization

� Message level security

� Custom messages compression

� Custom transport (SOAP over UDP)

� OSGi (radar devices, dynamic updates)

Page 24: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

Dynamic Service Resolving

24

Page 25: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

25

Page 26: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

UDP Transport (Radio translation based)

26

Page 27: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

CXF Community

27

Getting involved

� Creating JIRA entries

� Submitting patches

� Participate in mailing list

� Improve Wiki documentation

� Publishing articles

Page 28: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

CXF Community

28

Roles

� User

� Developer (Contributor)

� Committer

� PMC Member

� PMC Chair

� ASF Member (Board Directors)

Page 29: REST and SOAP Services with Apache CXF - Entwicklertag · ♥SOPERA GmbH Document Identifier Background Software architect in TalendTeam Committer in Apache CXF and Syncope projects

♥ SOPERA GmbH

Docum

ent Id

entifie

r

29

Links

� http://cxf.apache.org – Apache CXF Project

� http://www.talend.com/ - CXF based Open Source ESB

� http://coheigea.blogspot.de/ - CXF Security

� http://sberyozkin.blogspot.de/ - CXF Rest

� http://ashakirin.blogspot.de/ - Policies, transport, XKMS