Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Apache Axis: Open Source Web Service Platform
Chris HaddadSenior Consultant, Burton Group
O’Reilly Open Source ConventionJuly 26–30, 2004
Chris Haddad, Senior Consultant, Burton Group
Apache Axis: Web Services Platform
We are
here
Chris Haddad, Senior Consultant, Burton Group
• 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
Chris Haddad, Senior Consultant, Burton Group
• Agenda– Web Services Review– Web Services Platform – Axis Architecture– Axis Advanced– Building Axis clients and services– Get Rolling!
Apache Axis: Web Services Platform
Chris Haddad, Senior Consultant, Burton Group
Web Services Review: Service-Oriented Computing
Chris Haddad, Senior Consultant, Burton Group
• 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
Web services management extensions
Web services platform (tools)• Development• Deployment • Management
Web services platform (runtime)
Chris Haddad, Senior Consultant, Burton Group
Web 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)
Chris Haddad, Senior Consultant, Burton Group
Axis Architecture: Web Services Runtime
Chris Haddad, Senior Consultant, Burton Group
Axis Architecture: Detailed 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
Chris Haddad, Senior Consultant, Burton Group
Axis Architecture: Extension Points
Chris Haddad, Senior Consultant, Burton Group
Axis Architecture: Transport
– Interface to network protocol– Accept SOAP requests– Create Message Context– Send SOAP Response
SOAP Request
SOAP Response
MessageContext
TransportListener(http)
Chris Haddad, Senior Consultant, Burton Group
Axis Architecture: Message Processing
– 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
Axis Engine
SOAP Request
SOAP Response
MessageContext
TransportListener(http)
Chain (request)
Handler Handler
Chain (response)
Handler
Chris Haddad, Senior Consultant, Burton Group
SOAP Response
SOAP Request
Fault Flow
Request flow
Response flow
Pivot Handler(provider)
TransportListener(http)
– Assignment of processing blocks for SOAP request separated from SOAP response
– Exception processing channel defined by Fault Flow
Axis Architecture: Message Flows
Chris Haddad, Senior Consultant, Burton Group
Transport Chains
Global Configuration
Chains
LocalService Chains
– Localize execution of handlers and chains– Header fault check (MU)
Identification of SOAP node
Axis Architecture: Processing Scope
SOAP Response
SOAP Request
Fault Flow
Request flow
Response flow
Pivot Handler(provider)
TransportListener(http)
Chris Haddad, Senior Consultant, Burton Group
Axis Engine
Chain (request)
Handler Handler
Axis Architecture: Serialization Framework
– 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
Chris Haddad, Senior Consultant, Burton Group
Axis Engine
ServiceEndpoint
ServiceProvider
(rpc)
SerializationFramework
MessageContext
SOAP Request
SOAP Response
TransportListener(http)
Chain (request)
Handler Handler
Axis Architecture: Service Dispatching
– Load web service agent– Format endpoint call– Execute business logic– Serialize return value as SOAP message
Chain (response)
Handler
Chris Haddad, Senior Consultant, Burton Group
Axis Architecture: Deployment Descriptor• 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>
Chris Haddad, Senior Consultant, Burton Group
Axis Advanced: Advanced Tooling– Development
• WSDL2Java• Java2WSDL
– Deployment• AdminClient
– Management• Tcpmon• SOAPMonitor
Chris Haddad, Senior Consultant, Burton Group
• 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: Supporting Java Standards
Chris Haddad, Senior Consultant, Burton Group
Axis 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
– Messaging vs. RPC
Chris Haddad, Senior Consultant, Burton Group
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
Chris Haddad, Senior Consultant, Burton Group
•Building a new service– Starting points
• 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 a Web Service
Chris Haddad, Senior Consultant, Burton Group
Web Service Components
Chris Haddad, Senior Consultant, Burton Group
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
Chris Haddad, Senior Consultant, Burton Group
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
Chris Haddad, Senior Consultant, Burton Group
– 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
Interested in more information?