Neal Ford - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Neal Ford

Description:

White pages. Yellow pages. Green pages. Technical models. UDDI and Java ... A very active Yahoo list of SOAP developers. Detailed discussions of ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 31
Provided by: chan273
Category:
Tags: ford | neal | pages | white | yahoo

less

Transcript and Presenter's Notes

Title: Neal Ford


1
Building Web Services with Java
  • Neal Ford
  • CTO, The DSW Group, Ltd.
  • Tuesday, September 10, 2002

2
What This Session Will Cover
  • Decrypting the alphabet soup of web services
  • SOAP
  • Axis
  • Configuration
  • Deployment of web services
  • Simple
  • Complex
  • XML lt-gt Java data mapping
  • WSDL
  • UDDI
  • Application integration
  • Interoperability

3
The Alphabet Soup
  • XML
  • Extensible Markup Language
  • SOAP
  • Simple Object Access Protocol
  • WSDL
  • Web Services Definition Language
  • UDDI
  • Universal Description Discovery and Integration

4
SOAP
  • Overview of SOAP
  • SOAP Envelope Framework
  • SOAP Envelope
  • SOAP Versioning
  • SOAP Headers
  • SOAP Body
  • SOAP Intermediaries
  • Defined
  • Uses
  • Crossing trust domains
  • Ensuring scalability
  • Providing value-added services along the message
    path

5
SOAP
  • Error Handling
  • SOAP Data Encoding
  • Specifying different encodings
  • Data encoding rules
  • SOAP protocol bindings
  • HTTP/HTTPS
  • SOAP with attachments
  • SOAP over SMTP

6
SOAP and Java
  • Working with XML in Java
  • XML parsing with Xerces
  • XSL/XSLT transformations with Xalan
  • Publishing Frameworks and Cocoon
  • Apache SOAP v2
  • AXIS

7
Axis (Apache Extensible Interaction System
  • Where to get it
  • http//xml.apache.org/axis
  • Axis includes
  • a simple stand-alone server,
  • a server which plugs into servlet engines such as
    Tomcat,
  • extensive support for the Web Service Description
    Language (WSDL)
  • emitter tooling that generates Java classes from
    WSDL.
  • some sample programs
  • a tool for monitoring TCP/IP packets.
  • General Architecture

8
Axis Components
  • Axis Engine
  • Handlers
  • Chain
  • Transports
  • Deployment/configuration
  • Serializers/deserializers

9
Simple Web Services
  • Axis handles through JWS files
  • Axis
  • Locates the file
  • Compiles the class
  • Converts SOAP calls correctly into invocations of
    your Java class
  • Example Simple Web Service

10
Custom Deployment and WSDD Files
  • Web Service Deployment Descriptor
  • XML document that defines deployment artifacts
  • ltdeployment xmlns"http//xml.apache.org/axis/wsdd
    /"
  • xmlnsjava"http//xml.apache.org/axis/wsdd/p
    roviders/java"gt
  •  ltservice name"MyService" provider"javaRPC"gt
  •   ltparameter name"className
  • value"samples.userguide.example3.MyS
    ervice"/gt
  •   ltparameter name"allowedMethods" value""/gt
  •  lt/servicegt
  • lt/deploymentgt
  • Deployed (and undeployed) with the AdminClient
    tool

java org.apache.axis.client.AdminClient
deploy.wsdd
11
More Advanced Deployment Options
  • WSDD files can specify specific details about the
    web service, including handlers and chains

ltdeployment xmlns"http//xml.apache.org/axis/wsdd
/"             xmlnsjava"http//xml.apache.org/a
xis/wsdd/providers/java"gt   lt!-- define the
logging handler configuration --gt  lthandler
name"track" type"javasamples.userguide.example4
.LogHandler"gt   ltparameter name"filename"
value"MyService.log"/gt  lt/handlergt    lt!--
define the service, using the log handler we just
defined --gt  ltservice name"LogTestService"
provider"javaRPC"gt   ltrequestFlowgt    lthandler
type"track"/gt   lt/requestFlowgt     ltparameter
name"className" value"samples.userguide.example4
.Service"/gt   ltparameter name"allowedMethods"
value""/gt  lt/servicegt lt/deploymentgt
12
XML lt-gt Java Data Mapping with Axis
  • Automatic serialization/deserialization for
    JavaBeans

ltbeanMapping qname"nslocal" xmlnsns"someNamesp
ace"              languageSpecificType"javamy.ja
va.thingy"/gt
  • It is also possible to write custom
    serializer/deserializers

13
WSDL (Web Services Description Language)
  • Primary elements of WSDL schema
  • PortType
  • Operation
  • Message
  • Binding
  • Port
  • Service
  • Definitions
  • Documentation

14
Axis Support for WSDL
  • Axis supports WSDL in three ways
  • Auto-generation of WSDL via the ?WSDL flag
  • WSDL2Java tool
  • Java2WSDL tool

15
WSDL2Java
  • Tool that generates Java stub classes from WSDL
    descriptions

java org.apache.axis.wsdl.WSDL2Java
(WSDL-file-URL)
16
WSDL2Java
  • Given

ltxsdcomplexType name"phone"gt   ltxsdallgt     ltxs
delement name"areaCode" type"xsdint"/gt     ltxs
delement name"exchange" type"xsdstring"/gt     
ltxsdelement name"number" type"xsdstring"/gt   lt
/xsdallgt lt/xsdcomplexTypegt
  • WSDL2Java generates

public class Phone implements java.io.Serializable
    public Phone() ...     public int
getAreaCode() ...     public void
setAreaCode(int areaCode) ...     public
java.lang.String getExchange() ...     public
void setExchange(java.lang.String exchange)
...     public java.lang.String getNumber()
...     public void setNumber(java.lang.String
number) ...     public boolean equals(Object
obj) ...     public int hashCode() ...
17
Holders
  • JAX-PRC defines both in and inout parameters
  • Axis and WSDL2Java handle this by generating
    holder classes
  • Works like Helpers in CORBA

package samples.addr.holders public final class
PhoneHolder implements javax.xml.rpc.holders.Holde
r public samples.addr.Phone value
public PhoneHolder() public
PhoneHolder(samples.addr.Phone value)
this.value value
18
Java2WSDL
  • Provide a Java interface or class

package samples.userguide.example6 /  
Interface describing a web service to set and get
Widget prices.  / public interface WidgetPrice
    public void setWidgetPrice(String
widgetName, String price)     public String
getWidgetPrice(String widgetName)
19
Java2WSDL
  • Use Java2WSDL to create a WSDL file

java org.apache.axis.wsdl.Java2WSDL -o wp.wsdl 
-l"http//localhost8080/axis/services/WidgetPri
ce" -n  "urnExample6" -p"samples.userguide.exam
ple6" "urnExample6"  samples.userguide.example6
.WidgetPrice
  • Where
  • -o indicates the name of the output WSDL file
  • -l indicates the location of the service
  • -n is the target namespace of the WSDL file
  • -p indicates a mapping from the package to a
  • namespace. There may be multiple mappings.
  • The class specified contains the interface of the
    webservice.

20
Java2WSDL
  • Create bindings using WSDL2Java

java org.apache.axis.wsdl.WSDL2Java -o . -d
Session -s -S true  -NurnExample6
samples.userguide.example6 wp.wsdl
  • Generated files

21
Java2WSDL
  • Generated files (continued)

22
UDDI (Universal Description Discovery and
Integration)
  • UDDI (logical) registries
  • Business (businessEntity)
  • Reference types (tModel)
  • Business entity
  • White pages
  • Yellow pages
  • Green pages
  • Technical models
  • UDDI and Java

23
Retrofitting Existing Applications
  • Handling web services requirements
  • Statelessness
  • Granularity
  • Existing J2EE applications
  • Expose select functionality via web services
  • Web projects
  • Code must be written in web service calls to
    handle web service work
  • Can use either JWS deployment or custom
    deployment
  • EJB
  • Web services (accessed via Axis in the servlet
    layer) call stateless session beans to perform
    work
  • Session beans perform required work

24
Transaction Processing
  • If you already have EJBs
  • Handled via normal transaction semantics via
    session and entity beans
  • If you have only servlets
  • Handled by code written in the web service
    methods exposed from the application
  • Two-phase commit is difficult across web service
    invocations
  • Impending transaction standards
  • TIP (Transaction Internet Protocol)
  • Simple 2-phase commit protocol over TCP/IP
  • XAML (XML Transaction Authority Markup Language)
  • Promising concept but still no specification

25
Interoperability
  • Cross language/framework/platform
  • Other Java web services
  • The .NET framework
  • Other languages/frameworks
  • Enforcing interoperability
  • SOAPBuilders
  • A very active Yahoo list of SOAP developers
  • Detailed discussions of interoperability issues
  • The Interoperability Lab
  • http//www.xmethods.net/ilab
  • Includes resources such as the SOAP validator
    test suite, standard ways to test web services

26
Tool Support
  • Example Borlands JBuilder Web Services Preview
    Kit
  • Integrates Axis into JBuilder
  • Wizards for
  • Creating SOAP Server
  • Importing WSDL
  • Exporting a class as a web service
  • Application Servers
  • BEA WebLogic
  • IBM Websphere
  • IONA XMLBus

27
Axis Alternatives
  • GLUE
  • Commercial product from Mind Electric, addresses
    the same space as Axis
  • Contains numerous features to make developing web
    services very easy
  • Customizable serialization/deserialization via
    decorated XMLSchema files
  • Custom XML parser (ElectricXML)
  • Java lt-gt XML persistence engine
  • Built in servlet engine
  • WASP
  • http//www.idoox.com
  • SOAP RMI
  • http//www.extreme.indiana.edu/soap

28
Web Services Reliability
  • Peter Deutschs Eight Fallacies of Distributed
    Computing
  • The network is reliable
  • Latency is zero
  • Bandwidth is infinite
  • The network is secure
  • Topology doesn't change
  • There is one administrator
  • Transport cost is zero
  • The network is homogeneous

29
The Future
  • Web services will be the defining paradigm for
    distributed computing in the near term
  • It is important that all web services
    interoperate successfully
  • Web services and Java
  • Full support from the open source and commercial
    communities
  • Built on top of an existing proven infrastructure
    (J2EE)
  • Very high scalability
  • Multiple vendor support
  • Cross platform
  • Tools are making it easier and easier to publish
    web services from Java applications, both J2EE
    and otherwise

30
Questions?To download sampleshttp//www.thedsw
group.com/conferences
  • Neal Ford
  • CTO
  • The DSW Group, Ltd.
  • nford_at_thedswgroup.com
Write a Comment
User Comments (0)
About PowerShow.com