SOA using Java Web Services
Mark Hansen
Founder & President AgileIT
[Link]
(Delete this element) If applicable, place your company logo here
Overall Presentation Goal
Learn how to build SOA Applications using JAX-WS, JAXB, and Ajax
(JAX-RS on Thursday)
[Link]
Speakers Qualifications
!
Mark Hansen is the Founder and President of AgileIT Author of SOA Using Java Web Services Developed the SOA-J Framework PhD from MITs Lab for Computer Science
[Link]
Java Web Services have greatly improved since J2EE 1.4
The Java 6 (JEE 5) Java Web Services Tools enable real SOA Application Development.
[Link]
SOA Using Java Web Services - Outline
Intro: Am I Stupid, or Is Java Web Services Really Hard? Part I: Architecture, Concepts, Standards
! ! ! !
Web Services Platform Architecture (WSPA) Basic REST with HttpServlet WSDL, SOAP, and Java/XML Binding JAXB and JAX-WS
Break (30 minutes)
[Link]
SOA Using Java Web Services Outline (Cont)
!
Part II: Building Real Applications
! !
Code First, Contract First, and Meet in the Middle SOA Integration Case Study (eBay, Amazon, Yahoo!)
[Link]
SOA Using Java Web Services - Introduction
Am I Stupid, or Is Java Web Services Really Hard?
[Link]
SOA Using Java Web Services - Introduction
[Link]
SOA Using Java Web Services - Introduction Web Services are Hard
!
SOA = Loosely Coupled Distributed Computing with Web Services
! ! ! ! !
Concurrency Fault Tolerance Transparency Scalability Impedance Mismatch
"A distributed system is one in which the failure of a computer you didn't even know existed can render your own computer unusable." - Leslie Lamport
[Link]
SOA Using Java Web Services - Introduction Impedance Mismatch
[Link]
SOA Using Java Web Services - Outline
Intro: Am I Stupid, or Is Java Web Services Really Hard? Part I: Architecture, Concepts, Standards
! ! ! !
Web Services Platform Architecture (WSPA) Basic REST with HttpServlet and JAX-WS WSDL, SOAP, and Java/XML Binding JAXB, JAX-WS
Break (30 minutes)
[Link]
SOA Using Java Web Services Part I Web Services Platform Architecture
!
Invocation
! ! !
Proxies Represent Web Services in Java Interface to Messaging System (HTTP) QoS (Handlers) Java/XML Binding Implement Web Service Endpoints (SOAP, REST) with Java
[Link]
Marshalling (Impedance Matcher)
!
Deployment
!
SOA Using Java Web Services Part I WSPA - Invocation
[Link]
SOA Using Java Web Services Part I WSPA Proxy
[Link]
SOA Using Java Web Services Part I WSPA Marshalling
[Link]
SOA Using Java Web Services Part I WSPA Deployment
[Link]
SOA Using Java Web Services - Outline
Intro: Am I Stupid, or Is Java Web Services Really Hard? Part I: Architecture, Concepts, Standards
! ! ! ! !
Web Services Platform Architecture (WSPA) Basic REST with HttpServlet and JAX-WS WSDL, SOAP, and Java/XML Binding JAXB and JAX-WS JAX-RS (Under Development for Java EE 6)
Break (30 minutes)
[Link]
SOA Using Java Web Services Part I Basic REST SOAP Comparison
REST SOAP
Message Format XML1 SOAP WSDL HTTP3, FTP, MIME, JMS, SMTP, etc. Interface Definition None2 Transport
1. 2. 3.
HTTP
Also uses HTTP headers and query string. XML Schema sometimes provided. And out of band documentation. Without WS-Addressing, SOAP relies on the message transport for dispatching (e.g., HTTP context path).
[Link]
SOA Using Java Web Services Part I Basic REST HttpURLConnection (JDK 1.1)
[Link]
SOA Using Java Web Services Part I Basic REST Dispatch<Source> (JAX-WS 2.0 )
[Link]
SOA Using Java Web Services Part I Basic REST - HttpServlet
[Link]
SOA Using Java Web Services Part I Basic REST Provider<Source>
[Link]
DEMO
Basic REST HttpServlet vs. Provider<T>
SOA Using Java Web Services - Outline
Intro: Am I Stupid, or Is Java Web Services Really Hard? Part I: Architecture, Concepts, Standards
! ! ! ! !
Web Services Platform Architecture (WSPA) Basic REST with HttpServlet and JAX-WS WSDL, SOAP, and Java/XML Binding JAXB and JAX-WS JAX-RS (Under Development for Java EE 6)
Break (30 minutes)
[Link]
SOA Using Java Web Services Part I The Role of WSDL in Enterprise SOA
[Link]
SOA Using Java Web Services Part I SOAP Dispatching
[Link]
SOA Using Java Web Services Part I Java/XML Binding
[Link]
SOA Using Java Web Services - Outline
Intro: Am I Stupid, or Is Java Web Services Really Hard? Part I: Architecture, Concepts, Standards
! ! ! ! !
Web Services Platform Architecture (WSPA) Basic REST with HttpServlet and JAX-WS WSDL, SOAP, and Java/XML Binding JAXB and JAX-WS JAX-RS (Under Development for Java EE 6)
Break (30 minutes)
[Link]
SOA Using Java Web Services Part I JAXB Binding vs. Mapping
[Link]
SOA Using Java Web Services Part I JAXB The Standard Binding
[Link]
SOA Using Java Web Services Part I JAXB Custom Mappings with DIY Recursion
[Link]
SOA Using Java Web Services Part I JAXB Customization with XmlAdapter
[Link]
SOA Using Java Web Services Part I JAX-WS Client Side Invocation with Proxy
[Link]
SOA Using Java Web Services Part I JAX-WS WSDL to Java Binding
[Link]
SOA Using Java Web Services Part I JAX-WS Server Side Invocation Subsystem
[Link]
SOA Using Java Web Services Part I JAX-WS SOAP Fault Message
[Link]
DEMO
Examining the JAX-WS WSDL ! Invoking a Web Service
!
SOA Using Java Web Services - Outline
Intro: Am I Stupid, or Is Java Web Services Really Hard? Part I: Architecture, Concepts, Standards
! ! ! !
Web Services Platform Architecture (WSPA) Basic REST with HttpServlet WSDL, SOAP, and Java/XML Binding JAXB and JAX-WS
Break (30 minutes)
[Link]
SOA Using Java Web Services Outline (Cont)
!
Part II: Building Real Applications
! !
Code First, Contract First, and Meet in the Middle SOA Integration Case Study (eBay, Amazon, Yahoo!)
[Link]
SOA Using Java Web Services Part II Code First, Contract First, Meet in the Middle
JAX-WS Java to WSDL Standard Mapping JAXB Schema Generator
JAX-WS WSDL to Java Standard Mapping JAXB Schema Compiler
???
[Link]
SOA Using Java Web Services Part II Code First
!
The Demo before the break illustrated Code First development. Start with a Java Class and generate WSDL using JAX-WS. Modify the WSDL using Annotations.
[Link]
SOA Using Java Web Services Part II Contract First
! !
Start with WSDL and XML Schema. JAX-WS WSDL to Java Binding and JAXB provide a mapping to Java. J2SE 6 provides the wsimport tool.
[Link]
SOA Using Java Web Services Part II Meet in the Middle ! Start with WSDL and XML Schema ! 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 and XML Schema.
This is the most common scenario faced by enterprises that are implementing SOA using Java Web Services.
[Link]
SOA Using Java Web Services Part II Meet in the Middle
!
To illustrate Meet in the Middle, we look at a SOA integration case study. Step back for a few minutes to look at the architecture. Then, look at some Meet in the Middle code.
[Link]
SOA Using Java Web Services Outline (Cont)
!
Part II: Building Real Applications
! !
Code First, Contract First, and Meet in the Middle SOA Integration Case Study (eBay, Amazon, Yahoo!)
[Link]
What is AJAX?
!
! !
Asynchronous JavaScript and XML An Interaction Model A Set of Technologies for Rich Client Development ... A Composite Application Framework for Flexible Business Process Management ???
! !
Ajax In Action, Dave Crane et al., Chapter 2 pg 33
[Link]
SOA Using JWS and Ajax
[Link]
SOAShopper Architecture
[Link]
eBay WSDL
[Link]
Ant Task to Compile eBay WSDL
[Link]
Using the Generated eBay API
[Link]
A Client Binding Example
public List<Offer> offerSearch( String keywords, Category category, Price lowprice, Price highprice) {
ShopperImp binding = [Link]( [Link], [Link]);
return [Link](keywords, category, lowprice, highprice); }
[Link]
Meet in the Middle Service Integration Bridge
[Link]
Meet in the Middle Object Integration Bridge
[Link]
Implementing a Binding Service
public abstract class BindingService { public static <C> C getBinding( Class<C> client, Class<?> service) { ... } }
[Link]
Demo
SOAShopper Integrating Yahoo!, Amazon, and eBay
Flash Demo
[Link]
Using the Dojo Table Widget
<table dojoType="filteringTable" id="fromSOAShopperData" multiple="true" alternateRows="true" cellpadding="0" cellspacing="0" border="0" style="margin-bottom:24px;"> <thead> <tr> <th field="source" dataType="String">Source</th> <th field="thumbnail" dataType="html" align="center">Image</th> <th field="price" dataType="String">Price</th> <th field="summary" dataType="String">Summary</th> <th field="url" dataType="html">Link</th> </tr> </thead> </table>
[Link]
Invoking the REST Endpoint
function retrieveURL(url) { restURL = url; showSearchingMsg(restURL); if ([Link]) { // Non-IE browsers req = new XMLHttpRequest(); [Link] = processStateChange; try { [Link]("GET", url, true); [Link]('Content-type','text/xml'); } catch (e) { alert(e); } [Link](null); } else if ([Link]) { // IE req = new ActiveXObject("[Link]"); ... } }
[Link]
Loading the Dojo Table
function populateTableFromLiveSOAShopperData() { try { var w = [Link] ("fromSOAShopperData"); [Link](theSOAShopperLiveData); } catch(e) { alert(e); } }
[Link]
Summary
! ! ! !
Summary point one Summary point two Summary point three Summary point
Instructions: (Delete this element)
This is where the END portion of the presentation starts. Summarize all of the key content points covered in your presentation.
[Link]
Concluding statement
Insert concluding statement or quote here. Remember, this is the final take-away that will challenge your audience with a call to action.
Instructions: (Delete this element)
This is the time to challenge your audience with a call to action. What would you like them to think, do, or feel as a result of attending your presentation?
[Link]
Q&A
View JavaPolis talks @ [Link]