apache axis: open source web services...
TRANSCRIPT
All Contents © 2003 Burton Group. All rights reserved.
Apache Axis: Open Source Web Services Platform
Chris HaddadSenior Consultant
February 26, 2004
2Apache Axis: Web Services Platform
We are
here
3
Thesis• Demanding business environment
• Support the virtual enterprise• Access actionable information in real-time• Integrate with 2nd and 3rd tier partners
• Web Service Platform opportunity• Automatic generation of communication bridge• Heterogeneous interoperability
• Platform of choice = Axis• Flexible, extendible, component model• Advanced tooling
Apache Axis: Web Services Platform
4
Agenda• Web Services Review• Web Services Platform • Axis Architecture• Axis Advanced• Building Axis clients and services• Get Rolling!
Apache Axis: Web Services Platform
5Web Services Review: Technical Definition
A Web Service:• An application that exposes its functionality through a
“Web API”• Built using the Web Services Framework
Web Services Framework:• A new type of middleware technology • For application-to-application communication• Based on XML, SOAP, WSDL, UDDI
6Web Services Review: Business Definition
Integration technology• Heterogeneous interoperability• For internal and external applications• Relies on pervasive Internet technology
Supports a Service-Oriented Architecture• Reusability • Consistency• Flexibility• Centralized control• Multi-user/multi-constituency support
7
ServiceProvider
ServiceContract
Service
ServiceConsumer
Client
ServiceBroker
RegisterFind
Bind
Web Services Review: Service-Oriented ComputingWeb Services Review: Service-Oriented Computing
8Web Services Review: Service-Oriented Computing
9
Web Services Framework: XML, SOAP, WSDL, UDDI
Web Services Review: Core Technologies
UDDIRegistry
WSDL
WebService
SOAPClient
Points to description
Points to serviceDescribesServiceFinds
Service
Communicates withXML Messages
10Web Services Platform
Web services management extensions
Web services platform (tools)• Development• Deployment • Management
What is a Web Services Platform?• Tools
• Generate WSDL and proxies• Administer services• Monitor traffic
• Run-time• SOAP Message processing• Service agent invocation
• Management Extensions• Monitoring• Service Provisioning• Security
Web services platform (runtime)
11Web Services Platform: Runtime
Client
Corporate applicationDesktop application
Wireless deviceWeb portal
etc.
Java Application Server
WSDL
SOAPProxy
Web Services Runtime Server
Web services runtime server
Code generated by WS tools
SOAPMessageProcessor
WebService
The application that implements
the service
WS Container
SOAP and WSDL
processing
Application code
DB
Legacy
DeploymentDescriptor(WSDD)
12Axis Architecture: Web Services Runtime
13
Service Dispatcher
Axis Architecture: Web Services Platforms
Message ProcessingPipeline Service Agent
(Web Service)
Transport
SOAP Message Processor
Web Services Runtime Server
Web Service Container
Serialization Framework
AdministrationServices
ConfigurationRepository
Tools
Axis Components overview
SecurityFramework
14Axis Architecture
Axis Components – Detail View
Administration
Service Dispatch
MSG
Message processing
Handlers
SecurityManagement
Transform
SerializationFramework
DeserializerSerializer
Java Object Configuration Repository
Type Mapping
Flows
FaultResponse
Request
ServiceConfiguration
Transport
HTTP
Web Service
SMTP
BEEP
JMS
ToolsAdminClient
Java2WSDL
WSDL2Java
SOAPMonitor
COMEJBRPC
Security
15Axis Architecture
Extension Points
16Axis Architecture
Transport Responsibilities• Interface to network protocol• Accept SOAP requests• Create Message Context• Send SOAP Response
SOAP Request
SOAP Response
MessageContext
TransportListener(http)
17
Axis Engine
SOAP Request
SOAP Response
MessageContext
TransportListener(http)
Axis Architecture
Message Processing Responsibilities• Identification of SOAP node’s role and initialize blocks• Map SOAP message to Java objects • Invoke interceptors (chains and handlers)• Process SOAP header directives• Hand-off to service dispatcher
Chain (request)
Handler Handler
Chain (response)
Handler
18Axis Architecture
SOAP Response
SOAP Request
Request flow
Response flow
Fault Flow
Pivot Handler(provider)
TransportListener(http)
Message Flows• Assignment of processing blocks for SOAP request
separated from SOAP response• Exception processing channel defined by Fault Flow
Axis Architecture
19Axis Architecture
SOAP Request
SOAP Response
Request flow
Response flow
Fault Flow
Transport Chains
Global Configuration
Chains
LocalService Chains
TransportListener(http) Pivot Handler
(provider)
Processing Scope• Localize execution of handlers and chains• Header fault check (MU) Identification of SOAP node
Axis Architecture
20
Axis Engine
Chain (request)
Handler Handler
Axis ArchitectureSerialization Framework Capabilities• Mapping Java types to/from XML determined by
• literal schema or section 5 encoding style. Document and rpc conventions.• JAX-RPC compliant
• Typical mappings• primitive data types (int, char, float, etc.) • Generic arrays and Java beans• custom serialization
Chain (response)
Handler
MessageContext
SOAP Request
SOAP Response
TransportListener(http)
SerializationFramework
Best Practice Tips:•Use doc/literal•Avoid collections•Use MSG-style to bypass body serialization
21
Axis Engine
ServiceEndpoint
ServiceProvider
(rpc)
SerializationFramework
Axis Architecture
Service Dispatching Responsibilities• Load web service agent• Format endpoint call• Execute business logic• Serialize return value as SOAP message
MessageContext
SOAP Request
SOAP Response
TransportListener(http)
Chain (request)
Handler Handler
Chain (response)
Handler
22Axis ArchitectureAxis Registry Deployment Descriptor (WSDD) Key Elements
• Service Descriptor• SOAP URI• Dispatcher type• Service Java class• WSDL File• Type mappings and handlers
• Handler Descriptor• Logical name• Handler Java class• Configuration parameters
• Type Mapping• XML QName• Java serialization class• Factories
<deployment><handler>
<parameters></handler><service>
<typemapping/></service>
</deployment>
23Axis Advanced
Advanced Tools• Development
• WSDL2Java• Java2WSDL
• Deployment• AdminClient
• Management• Tcpmon• SOAPMonitor
24
Advanced Interoperability through Java Web Service Standards
JAX-RPC: RMI-style API• Application interacts via native Java objects• Standard Java to/from XML mappings• Proxy automatically generates SOAP messages• WSDL-aware
SAAJ: Low-level API• Application works with SOAP envelope• Attachments
JWSDL: WSDL API• Used by SOAP runtime and tools (WSDL compiler and generators)• Used with DII
J2EE Integration• JMS• EJB
Axis Advanced
25Axis Advanced
Client API Choices• Compiled Stub
• Compile time binding• Service interface and proxy specifics defined at compile time
• Dynamic Proxy• Runtime binding• Service interface and protocol specifics defined at compile time
• Dynamic Invocation Interface (DII)• Runtime discovery• Service interface and protocol specifics determined at runtime
26Building Axis clients and services
Practical design• Building a Web Service
• Infrastructure handlers• Security• Session Management• Transformation
• Mapping Types• WSDL Generation
• Building a Client• Proxy code generation from WSDL or DII• Supporting complex types
27
Building a Web Service• Build a new service
• Start with code• Follow procedure for an existing application
• Start or follow-up with WSDL• WSDL compiler generates application skeleton• Fill in appropriate application code
• Best Practices• How to encapsulate an application
• Expose it directly• Build a façade, adapter, or wrapper
• Decision criteria:• Does it have an existing API?• What’s the interface granularity?
• Methods• Data Objects
Interoperability Tips
Don’t expose Java-centric objects to SOAP clients
(i.e. turn maps into arrays)
Polymorphism and inheritance can be
dangerous
Building Axis clients and services
28Building Axis clients and services
Web Service Components
29Building Axis clients and services
Building a Web Service Client• Find WSDL file• Generate client interface• Write the client code
• Use the interface to invoke operations on the remote service
30
Compiling a Client Proxy
Building Axis clients and services
Order ServiceSubmit OrderGet Order StatusList BackordersGet Customer HistoryGet Order History
Operation: Submit OrderInput message: OrderOutput message: ConfirmationUse: SOAP over HTTPLocation: http://my.org/orders
WSDL
GenerateCode
GenerateWSDL
ClientSubmitOrder
SOAPClientProxy
SOAP message<Order>
SOAP message<Confirmation>
31Axis: Open source web services platform
Features Recap• Component architecture
• Flexible configuration options• Multiple extension points (transport, message processing, encoding)
• Advanced tools and utilities• WSDL and proxy code generation• Service administration• Server-side and Client-side Infrastructure
• Interoperability• Automatic serialization of complex types• Major Web Service and Java standards supported
32
J2SE platforms• Apache Axis *• Apache SOAP *• U Indiana XSOAP *
J2EE platforms• Borland Enterprise Server ^• IBM WebSphere ^• JBoss .NET ^• Macromedia JRun ^• Oracle 9i ^• Pramati ^
^ Based on Apache Axis/SOAP* Open Source
Web Services Vendors• Infravio ^• Grand Central ^• FlamencoNetworks ^• Collaxa ^• SoapKnox ^
Axis momentum……• Version 1.1 ready to support the enterprise• Axis used by major J2EE and Web Service vendors
Axis: Open source web services platform
33
Interested in more information?• Axis Specific
• Home http://ws.apache.org/axis• Wiki http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages• Mailing lists http://ws.apache.org/axis/mail.html
• Interoperability• White Mesa http://www.whitemesa.net• Microsoft SOAP interop http://www.mssoapinterop.org
• Web Services Framework• SOAP1.1 http://www.w3.org/TR/SOAP/• WSDL 1.1 http://www.w3.org/TR/wsdl• XML Schema http://www.w3.org/TR/xmlschema-0/
• Java Web Services• JAX-RPC http://java.sun.com/xml/jaxrpc/• SAAJ http://java.sun.com/xml/saaj/• JWSDL http://www.jcp.org/en/jsr/detail?id=110
Axis: Open source web services platform