Building SOA Applications with JAX-WS, JAX- RS, JAXB, and Ajax



Similar documents
ITS. Java WebService. ITS Data-Solutions Pvt Ltd BENEFITS OF ATTENDANCE:

JVA-561. Developing SOAP Web Services in Java

WEB SERVICES. Revised 9/29/2015

Java Web Services Training

Developing Java Web Services

Introduction to CASA: An Open Source Composite Application Editor

Module 13 Implementing Java EE Web Services with JAX-WS

JAVA API FOR XML WEB SERVICES (JAX-WS)

Apache CXF Web Services

JAVA API FOR XML WEB SERVICES INTRODUCTION TO JAX-WS, THE JAVA API FOR XML BASED WEB SERVICES (SOAP, WSDL)

Reusing Existing * Java EE Applications from Oracle SOA Suite

Introduction to Oracle WebLogic. Presented by: Fatna Belqasmi, PhD, Researcher at Ericsson

JDeveloper 11g JAX-WS web services:

JBoss SOAP Web Services User Guide. Version: M5

JAX-WS Developer's Guide

Web Service Development Using CXF. - Praveen Kumar Jayaram

Grid Computing. Web Services. Explanation (2) Explanation. Grid Computing Fall 2006 Paul A. Farrell 9/12/2006

T Network Application Frameworks and XML Web Services and WSDL Tancred Lindholm

Web Services Development for IBM WebSphere Application Server V7.0. Version: Demo. Page <<1/10>>

WCF WINDOWS COMMUNICATION FOUNDATION OVERVIEW OF WCF, MICROSOFTS UNIFIED COMMUNICATION FRAMEWORK FOR.NET APPLICATIONS

rpafi/jl open source Apache Axis2 Web Services 2nd Edition using Apache Axis2 Deepal Jayasinghe Create secure, reliable, and easy-to-use web services

Author: Gennaro Frazzingaro Universidad Rey Juan Carlos campus de Mostòles (Madrid) GIA Grupo de Inteligencia Artificial

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR DEPARTMENT OF COMPUTER APPLICATIONS SUBJECT : MC7502 SERVICE ORIENTED ARCHITECTURE

GlassFish. Developing an Application Server in Open Source

Creating Web Services in NetBeans

Open Source SOA with Service Component Architecture and Apache Tuscany. Jean-Sebastien Delfino Mario Antollini Raymond Feng

02267: Software Development of Web Services

Distribution and Integration Technologies

Developing Web Services Applications

Introduction. Tom Dinkelaker, Ericsson Guido Salvaneschi, Mira Mezini, TUD

Service-oriented architecture in e-commerce applications

The presentation explains how to create and access the web services using the user interface. WebServices.ppt. Page 1 of 14

Improving performance for security enabled web services. - Dr. Colm Ó héigeartaigh

Acknowledgments. p. 55

FUSE-ESB4 An open-source OSGi based platform for EAI and SOA

Building and Using Web Services With JDeveloper 11g

Web Services in Oracle Fusion Middleware. Raghu Kodali Consulting Product Manager & SOA Evangelist Oracle Fusion Middleware Oracle USA

The end. Carl Nettelblad

SOA CERTIFIED JAVA DEVELOPER (7 Days)

Web Services ( )

IBM SPSS Collaboration and Deployment Services Version 6 Release 0. Single Sign-On Services Developer's Guide

MathCloud: From Software Toolkit to Cloud Platform for Building Computing Services

Middleware and the Internet. Example: Shopping Service. What could be possible? Service Oriented Architecture

Service Computing: Basics Monica Scannapieco

ebay : How is it a hit

Usage of Evaluate Client Certificate with SSL support in Mediator and CentraSite

Motivation Definitions EAI Architectures Elements Integration Technologies. Part I. EAI: Foundations, Concepts, and Architectures

Oracle WebLogic Server

Web-Service Example. Service Oriented Architecture

A-Team Tech Talk Series. SOA Unit Testing. Olivier LeDiouris, Oracle A-Team

GlassFish v3. Building an ex tensible modular Java EE application server. Jerome Dochez and Ludovic Champenois Sun Microsystems, Inc.

Web Services Technologies

WA2087 Programming Java SOAP and REST Web Services - WebSphere 8.0 / RAD 8.0. Student Labs. Web Age Solutions Inc.

Building Web Services with XML Service Utility Library (XSUL)

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE By using the RETE Algorithm Benefits of RETE Algorithm...

Web Services Technologies Examples from the Mainstream

1 What Are Web Services?

1 What Are Web Services?

Service-Oriented Architectures

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Introduction to Service-Oriented Architecture for Business Analysts

SOA Fundamentals For Java Developers. Alexander Ulanov, System Architect Odessa, 30 September 2008

Using DDS to Enable The Real-Time Enterprise Service Bus (RT-ESB)

Service Oriented Architecture using JAVA

Web Services Description Language (WSDL) Wanasanan Thongsongkrit

DEPLOYMENT ARCHITECTURE FOR JAVA ENVIRONMENTS

WEB SERVICES TEST AUTOMATION

Getting Started with Service- Oriented Architecture (SOA) Terminology

Intalio BPM. The first and only complete Open Source Business Process Management System

Solution Showcase Session. Enterprise 2.0 Computing Services

Service Oriented Architecture

Middleware and the Internet

Lesson 4 Web Service Interface Definition (Part I)

2. Define Contemporary SOA. Contemporary SOA represents an architecture that promotes service orientation through the use of web services.

C05 Discovery of Enterprise zsystems Assets for API Management

So You Want an SOA: Best Practices for Migrating to SOA in the Enterprise. Eric Newcomer, CTO

Open Source SCA The Apache Tuscany Project

Assessing the usefulness of the WS-I tools for interoperability testing

SCA-based Enterprise Service Bus WebSphere ESB

How To Create A C++ Web Service

Oracle Service Bus. Situation. Oracle Service Bus Primer. Product History and Evolution. Positioning. Usage Scenario

Developing Web Services with Apache CXF and Axis2

Smartcards with Webservice Interface

A standards-based approach to application integration

REST and SOAP Services with Apache CXF

Introduction to WebSphere Process Server and WebSphere Enterprise Service Bus

SOA using Open ESB, BPEL, and NetBeans. Sang Shin Java Technology Evangelist Sun Microsystems, Inc.

Java EE 7: Back-End Server Application Development

02267: Software Development of Web Services

David Pilling Director of Applications and Development

Metro Web Services, NetBeans, GlassFish and OpenSSO in Action with Amazon WS, Azure, and Office

How To Understand A Services-Oriented Architecture

Pro<DOC/> e-commerce Technology An Introduction

WebSphere ESB Best Practices

An Interface from YAWL to OpenERP

Transcription:

Building SOA Applications with JAX-WS, JAX- RS, JAXB, and Ajax Mark Hansen Founder & President, AgileIT mark@agileitinc.com S296157

Learn Powerful Coding Techniques for Building SOA Applications using JAX-WS, JAX-RS, and JAXB and Ajax. How to Leverage the Powerful Web Services Technologies Built In to Java application environment 2008 JavaOne SM Conference java.sun.com/javaone 2

About the Speaker Mark Hansen Author, SOA Using Java Web Services MIT PhD from Laboratory of Computer Science AgileIT Founder http://agileitinc.com AgileIT develops the ServiceLayer TM product for ultrafast Web Service enablement of production Java applications. 2008 JavaOne SM Conference java.sun.com/javaone 3

Agenda Introduction Java Bindings for Web Services Java language to XML Schema (JAXB) Java language to WSDL and SOAP (JAX-WS) Java language to HTTP (JAX-RS) Programming Methodologies Code First Contract First Meet in the Middle Case Study SOA-Shopper a universal shopping service integrating ebay, Amazon, and Yahoo! Shopping. Meet in the Middle Architecture Code Snippets Live Demo 2008 JavaOne SM Conference java.sun.com/javaone 4

Introduction Am I Stupid, or is Java Web Services Really Hard? 2008 JavaOne SM Conference java.sun.com/javaone 5

An Impedance Mismatch Can Make Web Services Hard Java Objects Mapping Impedance Mismatch XML WSDL HTTP SOAP Web Services Documents and Messages 2008 JavaOne SM Conference java.sun.com/javaone 6

Java Bindings for Web Services Java Binding tools are used to manage the impedance mismatch. Java platform now provides effective binding tools. JAXB binding to XML JAX-WS binding to WSDL and SOAP JAX-RS binding to HTTP Effective Java Web Services requires learning to use these tools effectively. 2008 JavaOne SM Conference java.sun.com/javaone 7

JAXB - Binding Java code to XML Schema XML Schema <complextype name= Foo > <sequence> <element name= bar type= FooBar > </sequence> </complextype> Java Code Foo public FooBar getbar() { } public setbar(foobar fb) { } FooBar 2008 JavaOne SM Conference java.sun.com/javaone 8

JAX-WS - Binding Java code to WSDL WSDL types JAXB porttype operation JAX-WS Service Endpoint Implementation (SEI) + method( ) 2008 JavaOne SM Conference java.sun.com/javaone 9

JAX-WS - Binding Java code to SOAP SOAP <env:envelope..> <env:head /> <env:body > <submitorder> <order > <date>20080507</date> <itemnum>dw0-88</itemnum> </order> </submitorder> </env:body> </env:envelope> JAX-WS JAXB Java OrderManager @WebService public class OrderManager { public void submitorder(order ord) { } } Orde r 2008 JavaOne SM Conference java.sun.com/javaone 10

JAX-RS - Binding Java code to HTTP HTTP POST /somepath/ordermanager/ordnum Host: agileitinc.com <order > <date>20080507</date> <itemnum>dw0-88</itemnum> </order> Java OrderManager @Path( /somepath/ordermanager ) public class OrderManager { @POST @PATH( /{ordnum} ) @ConsumeMime( application/xml ) public void submitorder( @PathParam( ordnum") String ordnum, Source order) { } } 2008 JavaOne SM Conference java.sun.com/javaone 11

Approaches to Web Services Development Java Java Java WSDL, XML, HTTP WSDL, XML, HTTP WSDL, XML, HTTP Code First Contract First Meet in the Middle 2008 JavaOne SM Conference java.sun.com/javaone 12

Code First Annotate Your Code Deploy it in a container that supports JAX-WS, JAX-RS The JAX-WS runtime will: Generate WSDL. Translate SOAP request to a Java technology-based method invocation. Translate method return into a SOAP response. The JAX-WS runtime will: Translate HTTP request to a Java technology-base method invocation. Translate method return into HTTP response. 2008 JavaOne SM Conference java.sun.com/javaone 13

Contract First Compile the WSDL for the service that you would like to deploy. wsimport reads the WSDL and generates and interface for each porttype Create a class that implements each interface. The business logic of these classes implements your Web services. Deploy these Service Endpoint Implementation classes to a JAX-WS container. 2008 JavaOne SM Conference java.sun.com/javaone 14

Code First and Contract First With JAX-WS 2008 JavaOne SM Conference java.sun.com/javaone 15

JAX-RS JAX-RS is more like Code First than Contract First No WSDL contract. However, XML Schema may provide a contract for the XML payload. Annotations are used to map Java code to REST endpoints (URIs) and to HTTP operations. @Path( /somepath/ordermanager ) public class OrderManager { @POST @PATH( /{ordnum} ) @ConsumeMime( application/xml ) public void submitorder( @PathParam( ordnum") String ordnum, Source order) { } } and also to map Java code to HTTP operations 2008 JavaOne SM Conference java.sun.com/javaone 16

Code First With JAX-RS 2008 JavaOne SM Conference java.sun.com/javaone 17

Meet in the Middle Start with WSDL, XML Schema, HTTP structure AND existing Java classes. Two sides of the same problem: Invoke the Web services using your existing Java classes as parameters (e.g., PurchaseOrder). Deploy your existing Java classes to provide Web services that conform to the existing WSDL, XML Schema, HTTP structure This is the most common scenario faced by enterprises that are implementing SOA using Java Web Services. Programming challenge: How to deal with the complex, ad-hoc, mapping code that must be created and maintained? 2008 JavaOne SM Conference java.sun.com/javaone 18

Meet in the Middle - Mapping Code Problem Supplier1 Web Service Supplier2 Web Service Supplier2 Web Service Contact First Classes PO1 PO2 PO3 Mapping Layer Map1 Map2 Map3 Code First Classes PO 2008 JavaOne SM Conference java.sun.com/javaone 19

Adapter Bindings Managing the Mapping Code Java WSDL, XML, HTTP Adapter Binding Implements Meet in the Middle Organizes, manages, maintains the mapping code in a library of reusable type mappings. Hides the complexity of mapping from business logic programmers. Meet in the Middle 2008 JavaOne SM Conference java.sun.com/javaone 20

Meet in the Middle: SOAShopper Example Web Browser Ajax SOAP Client RESTful Services JAX-RS SOAP Services JAX-WS SOAShopper Technology Stack SOAShopper API SOAShopper Mapping External Service APIs ebay Amazon Yahoo! Adapter Bindings ebay WS Amazon WS Yahoo! WS 2008 JavaOne SM Conference java.sun.com/javaone 21

Adapter Binding Example API API Mapping ebay Adapter Bindings public List<Offer> offersearch( String keywords, Category category, Price lowprice, Price highprice) { ebay WS ShopperImp binding = BindingService.getBinding( ShopperImp.class, EBayAPIInterface.class); return binding.offersearch(keywords, category, lowprice, highprice); } 2008 JavaOne SM Conference java.sun.com/javaone 22

Meet in the Middle Bridge Pattern (GOF) Shopper bridge -imp ShopperImp +offersearch() * +offersearch() ComputerShopper CellphoneShopper EBayShopperImp AmazonShopperImp YahooShopperImp -port -port -port EBayAPIInterface AWSECommerceService YahooRESTInterface 2008 JavaOne SM Conference java.sun.com/javaone 23

SOAShopper Integrating Yahoo! Shopping, Amazon, and ebay with JAX-WS, JAXB, and JAX-RS 2008 JavaOne SM Conference java.sun.com/javaone 24

For More Information AgileIT web site - http://agileitinc.com Jersey (JAX-RS impl.) - https://jersey.dev.java.net/ Metro (JAX-WS, JAXB impl.) - https://metro.dev.java.net/ SOA Using Java Web Services, Mark Hansen RESTful Web Services, Leonard Richardson et. al 2008 JavaOne SM Conference java.sun.com/javaone 25

Mark Hansen Founder & President, AgileIT mark@agileitinc.com S296157 2008 JavaOne SM Conference java.sun.com/javaone 26