Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Practical Guide to Apache Axis2 Rajith Attapattu,

Similar presentations


Presentation on theme: "A Practical Guide to Apache Axis2 Rajith Attapattu,"— Presentation transcript:

1 A Practical Guide to Apache Axis2 Rajith Attapattu, rajith@redhat.com

2 Rajith Attapattu : Toronto JUG Dec 05, 2006 2 About Me Senior Software Engineer @ Red Hat I hang around the following projects Apache Axis2, Qpid, Tuscany – Comitter Apache Synapse – Contributor SCA Binding Spec group Volunteer with Lanaka Software Found'n

3 Rajith Attapattu : Toronto JUG Dec 05, 2006 3 Examples http://people.apache.org/~rajith/samples/intro-sample.tar.gz

4 Rajith Attapattu : Toronto JUG Dec 05, 2006 4 Agenda Introduction Using POJOs with Axis2 Embedding Axis2 Integrating Axis2 How to debug/test a web service

5 Rajith Attapattu : Toronto JUG Dec 05, 2006 5 Axis2 From a 1000 feet

6 Rajith Attapattu : Toronto JUG Dec 05, 2006 6 What is Axis2 ? In simple terms a SOAP Engine Consumes and Produces messages Supports POX/HTTP + GET/POST Foundation for the Web Services Stack

7 Rajith Attapattu : Toronto JUG Dec 05, 2006 7 What is Axis2 ? Axis2 has an ecosystem around it Several WS projects extends Axis2 Built on top of Axis2 architecture Typically support a WS specification Ex: Apache Sandesha2, supports WS-RM

8 Rajith Attapattu : Toronto JUG Dec 05, 2006 8 What is Axis2 ? Supports key WS* specifications Axis2 (built in) : WS-Addressing, WS-Eventing Rampart Module : WS-Sec, WS-SC, WS-SP Rahas Module : WS-Trust Apache Sandesha2 : WS-RM Apache Kandula2 : WS-Cord'n, WS-AT, WS-BA Apache Neethi : WS-Policy Apache Synapse : Mediation + ESB

9 Rajith Attapattu : Toronto JUG Dec 05, 2006 9 Axis2 Highlights Hot Deployment Multiple Transport Support HTTP, JMS, SMTP, TCP Asynchronous Web Services WSDL Support (1.1 and 2.0) Extensible Module Architecture

10 Rajith Attapattu : Toronto JUG Dec 05, 2006 10 Axis2 Deployment Methods Deployed in a Servlet Container as WAR As a Standalone Sever Embedded in a another Application Inside a Spring Container Bundled inside another WAR file

11 Rajith Attapattu : Toronto JUG Dec 05, 2006 11 When a message is received..

12 Rajith Attapattu : Toronto JUG Dec 05, 2006 12 Message Receiver Simple Interface, good extention point Decouples the engine with MEPs Message Exchange Patterns IN_ONLY, OUT_ONLY, IN_OUT WSDL 2.0 defines 8 MEPs Supports Sync and Async operation styles

13 Rajith Attapattu : Toronto JUG Dec 05, 2006 13 Message Receiver We currently have RawXMLxxxMessageReceivers RPCxxMessageReceivers For example RawXMLInOnlyMessageReceiver RPCInOutAsyncMessageReceiver

14 Rajith Attapattu : Toronto JUG Dec 05, 2006 14 When a message is sent..

15 Rajith Attapattu : Toronto JUG Dec 05, 2006 15 AXIOM AXIs Object Model XML infoset representation Built on the StAX parser (JSR 173) Objects are built “On Demand”

16 Rajith Attapattu : Toronto JUG Dec 05, 2006 16 What Are Modules? Collection of Handlers & related resources Configuration (module.xml) Class files..etc Provides fine grained control of handlers Physical Isolation Logical Isolation WS-Addressing, WS-Security, WS-RM

17 Rajith Attapattu : Toronto JUG Dec 05, 2006 17 How Flexible are Modules? Concept of Availability Concept of Engaging Per System (Globaly) Per Service Group Per Service Per Operation

18 Rajith Attapattu : Toronto JUG Dec 05, 2006 18 Service Implementation Types POJOs Simple Java Beans that implement service logic Spring Beans Spring beans exposed as Web Services Generated Skeletons Custom generated from WSDL Raw XML OMElement based Interfaces Extensible Custom Message Receivers that replaces the standard ones

19 Rajith Attapattu : Toronto JUG Dec 05, 2006 19 Lets look at some code Axis2 supports both Schema first approach Code first approach WSDL2Code tool for Schema first Lets look at a very simple example Will introduce concepts as we go

20 Rajith Attapattu : Toronto JUG Dec 05, 2006 20 My First Axis2 Service Steps Lets write a simple Greeting Service POJO Write a deployment descriptor Package it and deploy

21 Rajith Attapattu : Toronto JUG Dec 05, 2006 21 Service Class

22 Rajith Attapattu : Toronto JUG Dec 05, 2006 22 Lets write the services.xml

23 Rajith Attapattu : Toronto JUG Dec 05, 2006 23 Package and Deploy Put the services.xml in the META-INF Create jar file Name it as GreetingService.aar Drop it in the Axis2 services directory Or upload through the Admin console

24 Rajith Attapattu : Toronto JUG Dec 05, 2006 24 Repository Structure Axis2 Repository | |___ Conf | | _ _axis2.xml | |___ modules | |__ addressing.mar | |___ services |__ greetingservice.aar

25 Rajith Attapattu : Toronto JUG Dec 05, 2006 25 Admin Console

26 Rajith Attapattu : Toronto JUG Dec 05, 2006 26

27 Rajith Attapattu : Toronto JUG Dec 05, 2006 27 Repository If Deployed in a Servlet Container The repository is axis2/WEB-INF Any other way deployment method You can designate any location

28 Rajith Attapattu : Toronto JUG Dec 05, 2006 28 WS Client with Axis2 Supports both sync and async invocations Configure options via the Options class Important classes to note org.apache.axis2.client.Options org.apache.axis2.client.ServiceClient org.apache.axis2.client.OperationClient

29 Rajith Attapattu : Toronto JUG Dec 05, 2006 29 WS Client with Axis2

30 Rajith Attapattu : Toronto JUG Dec 05, 2006 30 Async Client Invocation

31 Rajith Attapattu : Toronto JUG Dec 05, 2006 31 Pure Asynchrony

32 Rajith Attapattu : Toronto JUG Dec 05, 2006 32 POJO Support How to POJO with Axis2 JSR 181 support for annotations

33 Rajith Attapattu : Toronto JUG Dec 05, 2006 33 Warning Contract (Schema/WSDL) first is the recomended approach Don't just expose object heirachies Think message oritented not object oriented

34 Rajith Attapattu : Toronto JUG Dec 05, 2006 34 How to POJO with Axis2 Can add services programaticaly Quick and easy, good for testing Spport via the RPC Message Receiver Client side support via RPCClient Lets look at the simple example

35 Rajith Attapattu : Toronto JUG Dec 05, 2006 35 POJO Example

36 Rajith Attapattu : Toronto JUG Dec 05, 2006 36 Configuration Context

37 Rajith Attapattu : Toronto JUG Dec 05, 2006 37 JSR 181 Support Based on the Annotations framework Annotates POJOs as Web Services Part of JAX-WS Still work in progress @WebService, @WebMethod....etc

38 Rajith Attapattu : Toronto JUG Dec 05, 2006 38 Sample Annotated POJO

39 Rajith Attapattu : Toronto JUG Dec 05, 2006 39 Integrating with Axis2

40 Rajith Attapattu : Toronto JUG Dec 05, 2006 40 Integrate with Axis2 How can I embed Axis2 Spring Integration Hibernate with Axis2

41 Rajith Attapattu : Toronto JUG Dec 05, 2006 41 How can I embed Axis2? Embeding Axis2 in my application? Embeding Axis2 in my WAR file?

42 Rajith Attapattu : Toronto JUG Dec 05, 2006 42 Embedding Axis2 in my Application You don't always need to deploy Axis2 in a servlet container. You can run Axis2 standalone You can also embed Axis2 in your App

43 Rajith Attapattu : Toronto JUG Dec 05, 2006 43 Embedding in my App Just drop the Axis2 jars in your classpath Choice of JMS, HTTP, TCP or SMTP Lets look at an example

44 Rajith Attapattu : Toronto JUG Dec 05, 2006 44 Using SimpleHTTPServer Steps Create a ConfigurationContext Initialize the SimpleHTTPServer Start the server

45 Rajith Attapattu : Toronto JUG Dec 05, 2006 45 Using SimpleHTTPServer

46 Rajith Attapattu : Toronto JUG Dec 05, 2006 46 Embedding in a WAR file A good appraoch if you want to bundle Axis2 with your Web App Simply drop your jars in the lib folder Add Axis2 servlet to your web.xml

47 Rajith Attapattu : Toronto JUG Dec 05, 2006 47 Embedding in a WAR file Can I bundle my services in the WAR file? You can add the services in the exploded format under the WEB-INF Or you can add services programaticaly

48 Rajith Attapattu : Toronto JUG Dec 05, 2006 48 Embedding in a WAR file Steps Drop jars in the WEB-INF/lib folder Add Axis2 servlet in the web.xml Add your services In 'exploded format' Programatically

49 Rajith Attapattu : Toronto JUG Dec 05, 2006 49 Add AxisServlet to you web.xml

50 Rajith Attapattu : Toronto JUG Dec 05, 2006 50 Exploded Format

51 Rajith Attapattu : Toronto JUG Dec 05, 2006 51 Spring Integration Simple and easy configuration Expose Spring beans as Web Services Plugpoint to leverage Spring Lets look at a Simple example

52 Rajith Attapattu : Toronto JUG Dec 05, 2006 52 Simple Use Case for Spring Steps Define a service interface Implement your service interface Write your WebService that uses the service Inteface

53 Rajith Attapattu : Toronto JUG Dec 05, 2006 53 Define the Service Interface

54 Rajith Attapattu : Toronto JUG Dec 05, 2006 54 Service Implementation1

55 Rajith Attapattu : Toronto JUG Dec 05, 2006 55 Service Implementation2

56 Rajith Attapattu : Toronto JUG Dec 05, 2006 56 Writing the Web Service

57 Rajith Attapattu : Toronto JUG Dec 05, 2006 57 Configuration & Deployment Steps Write your spring config file Write the services.xml Deploy in a servlet environment Deploy in a non-servlet environment

58 Rajith Attapattu : Toronto JUG Dec 05, 2006 58 Spring Configuration

59 Rajith Attapattu : Toronto JUG Dec 05, 2006 59 Servlet Container - web.xml

60 Rajith Attapattu : Toronto JUG Dec 05, 2006 60 Servlet Container - services.xml

61 Rajith Attapattu : Toronto JUG Dec 05, 2006 61 Non-Servlet Env - services.xml

62 Rajith Attapattu : Toronto JUG Dec 05, 2006 62 Non-Servlet Env

63 Rajith Attapattu : Toronto JUG Dec 05, 2006 63 Hibernate with Axis2 Poped up in the list a couple of times Don't need to do anything special Add hibernate jars in your classpath

64 Rajith Attapattu : Toronto JUG Dec 05, 2006 64 JAX-WS Status Initial JAX-WS code drop from IBM JAX-WS component is built on top of Axis2 Target completion date is TBD

65 Rajith Attapattu : Toronto JUG Dec 05, 2006 65 How To Debug a Web Service Use remote debug to check you service Very useful to see what goes on the wire TCPMon from WS Commons is a good tool SOAP Monitor comes bundled with Axis2

66 Rajith Attapattu : Toronto JUG Dec 05, 2006 66 Remote Debugging Add the following JVM arguments This will start the server in debug mode Use Eclipse or IDEA (refer documentation)

67 Rajith Attapattu : Toronto JUG Dec 05, 2006 67 Using TCPMon Logs SOAP messages that passes through Can act as an intermediary Can act as a request sender Can act as a proxy Can simulate slow connections

68 Rajith Attapattu : Toronto JUG Dec 05, 2006 68 Using SOAP Monitor Axis2 module called soapmonitor.mar Engage globaly in axis2.xml Messages are forwarded to a SOAP monitor Can view the data via an Applet Disable by default for security reasons

69 Rajith Attapattu : Toronto JUG Dec 05, 2006 69 Resources http://ws.apache.org/axis2 axis-dev@ws.apache.org axis-user@ws.apache.org http://ws.apache.org/commons/tcpmon/ http://people.apache.org/~rajith/samples/intro-sample.tar.gz

70 Rajith Attapattu : Toronto JUG Dec 05, 2006 70 Questions?

71 Rajith Attapattu : Toronto JUG Dec 05, 2006 71 Thank you

72 Rajith Attapattu : Toronto JUG Dec 05, 2006 72 Feedback is appreciated rajith.attapattu@gmail.com


Download ppt "A Practical Guide to Apache Axis2 Rajith Attapattu,"

Similar presentations


Ads by Google