Quick Start Axis2 By Deepal Jayasinghe  [ [email_address] ] Georgia Institute of  Technology  And Apache Software Foundation
Who am I ? <ul><li>Present :  </li></ul><ul><ul><li>Graduate Student at Georgia Tech </li></ul></ul><ul><ul><li>Apache Mem...
Agenda  <ul><li>Web service in one line </li></ul><ul><li>POJO </li></ul><ul><li>Service Archive </li></ul><ul><li>Axis2 c...
Presentation Resources <ul><li>http://people.apache.org/~deepal/ac_us_09 </li></ul>
Axis2 POJO <ul><li>Deploy and Start Web Service in one line </li></ul><ul><li>Deploy POJO </li></ul><ul><li>Invoke it in R...
POJO Deployment  <ul><li>Write a Java class </li></ul><ul><li>Compile it  </li></ul><ul><li>Deploy into repository/pojo di...
Axis2 Archive  <ul><li>Why do we need it ? </li></ul><ul><li>What can we have inside an archive ? </li></ul>
Axis2 Client API <ul><li>There are two main APIs (Do it hard way, but more flexible) </li></ul><ul><ul><li>ServiceClient <...
ServiceClient APIs <ul><li>ServiceClient has the following set of APIs </li></ul><ul><ul><li>SendRobust </li></ul></ul><ul...
Adding Custom SOAP Headers  <ul><li>There are three main ways of adding a header </li></ul><ul><ul><li>Adding as a string ...
What is Option object? <ul><li>Option object is used to configure the client </li></ul><ul><li>HTTP properties </li></ul><...
Asynchronous Invocation <ul><li>There are two types </li></ul><ul><ul><li>Application level </li></ul></ul><ul><ul><li>Tra...
Dynamic Client  <ul><li>Creating a client on the fly </li></ul><ul><li>No need to provide an option object </li></ul><ul><...
Create a Client Using a WSDL <ul><li>First ensure you have </li></ul><ul><ul><li>SET AXIS2_HOME=c:axis2-1.5 </li></ul></ul...
Client-side Session Handling <ul><li>ServiceClient supports invoking a service in a session aware manner </li></ul><ul><ul...
Session Aware Service  <ul><li>There are four types </li></ul><ul><ul><li>Application </li></ul></ul><ul><ul><li>Transport...
Adding a Web Resource  <ul><li>Services can be deployed alone with a web resource (jsp , js , html etc) </li></ul><ul><li>...
Axis2 Module <ul><li>Modules are how Axis2 extends or provides quality of services </li></ul><ul><li>Implementation of WS-...
Axis2 Code Generation  <ul><li>There are many options for data binding frameworks </li></ul><ul><ul><li>ADB </li></ul></ul...
Axis2 Pluggable Components  <ul><li>Extending Axis2 deployment  </li></ul><ul><ul><li>Custom deployers </li></ul></ul><ul>...
Writing Our Own Deployer <ul><li>There are a few things when developing a new deployer </li></ul><ul><ul><li>How to make s...
Axis2 Observers <ul><li>Observing what happened inside AxisConfiguration </li></ul><ul><ul><li>Adding service </li></ul></...
Custom Message Receivers  <ul><li>A message receiver is MEP dependent  </li></ul><ul><li>A message receiver can be conside...
Adding a New Transport <ul><li>Adding a new transport framework is just a matter of </li></ul><ul><ul><li>Creating a Trans...
 
Want to Contribute ? <ul><li>Join axis-user and axis-dev list </li></ul><ul><li>Pick a JIRA and fix it </li></ul><ul><li>S...
Resources  <ul><li>Axis2 official web site </li></ul><ul><ul><li>http://ws.apache.org/axis2 </li></ul></ul><ul><li>Present...
Upcoming SlideShare
Loading in...5
×

Apachecon 2009

644

Published on

An easy way to learn Axis2. A talk at ApacheCon US 2009.

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
644
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Apachecon 2009

  1. 1. Quick Start Axis2 By Deepal Jayasinghe [ [email_address] ] Georgia Institute of Technology And Apache Software Foundation
  2. 2. Who am I ? <ul><li>Present : </li></ul><ul><ul><li>Graduate Student at Georgia Tech </li></ul></ul><ul><ul><li>Apache Member </li></ul></ul><ul><ul><li>PMC member Web service and Synapse </li></ul></ul><ul><li>Past : </li></ul><ul><ul><li>Member at WSO2. </li></ul></ul><ul><li>Axis2 developer since day one. </li></ul>
  3. 3. Agenda <ul><li>Web service in one line </li></ul><ul><li>POJO </li></ul><ul><li>Service Archive </li></ul><ul><li>Axis2 clients </li></ul><ul><li>Axis2 session example </li></ul><ul><li>Service extension – Module </li></ul><ul><li>Pluggable components </li></ul><ul><li>Tools </li></ul><ul><li>REST </li></ul><ul><li>Let's Fly on Cloud ... </li></ul>
  4. 4. Presentation Resources <ul><li>http://people.apache.org/~deepal/ac_us_09 </li></ul>
  5. 5. Axis2 POJO <ul><li>Deploy and Start Web Service in one line </li></ul><ul><li>Deploy POJO </li></ul><ul><li>Invoke it in REST manner </li></ul>
  6. 6. POJO Deployment <ul><li>Write a Java class </li></ul><ul><li>Compile it </li></ul><ul><li>Deploy into repository/pojo directory </li></ul><ul><li>Has limited control </li></ul><ul><li>A few issues when there are multiple classes </li></ul>
  7. 7. Axis2 Archive <ul><li>Why do we need it ? </li></ul><ul><li>What can we have inside an archive ? </li></ul>
  8. 8. Axis2 Client API <ul><li>There are two main APIs (Do it hard way, but more flexible) </li></ul><ul><ul><li>ServiceClient </li></ul></ul><ul><ul><li>OperationClient </li></ul></ul><ul><li>Let's find an easy way </li></ul><ul><ul><li>RPCServiceClient </li></ul></ul><ul><ul><li>Code generation </li></ul></ul>
  9. 9. ServiceClient APIs <ul><li>ServiceClient has the following set of APIs </li></ul><ul><ul><li>SendRobust </li></ul></ul><ul><ul><li>FireAndForget </li></ul></ul><ul><ul><li>SendReceive </li></ul></ul><ul><ul><li>SendReceiveNonBlocking </li></ul></ul>
  10. 10. Adding Custom SOAP Headers <ul><li>There are three main ways of adding a header </li></ul><ul><ul><li>Adding as a string header </li></ul></ul><ul><ul><ul><li>addStringHeader(QName headerName, String headerText) </li></ul></ul></ul><ul><ul><li>Adding as a SOAP header block </li></ul></ul><ul><ul><ul><li>addHeader(SOAPHeaderBlock header) </li></ul></ul></ul><ul><ul><li>Adding as an AXIOM element </li></ul></ul><ul><ul><ul><li>addHeader(OMElement header) </li></ul></ul></ul>
  11. 11. What is Option object? <ul><li>Option object is used to configure the client </li></ul><ul><li>HTTP properties </li></ul><ul><ul><li>Chunking </li></ul></ul><ul><ul><li>Proxies </li></ul></ul><ul><ul><li>Authentication (NTLM, Basic, Digest) </li></ul></ul><ul><ul><li>Timeouts (Socket, Connection) </li></ul></ul><ul><ul><li>Support GZIP </li></ul></ul><ul><ul><li>HTTP Headers, etc </li></ul></ul><ul><li>WS-Addressing properties (wsa:to , was:replyTo) </li></ul><ul><li>Generic properties (name, value pairs) </li></ul>
  12. 12. Asynchronous Invocation <ul><li>There are two types </li></ul><ul><ul><li>Application level </li></ul></ul><ul><ul><li>Transport level </li></ul></ul><ul><li>Uses the callback mechanism </li></ul><ul><li>Provides the implementation object of AxisCallback, which has the following methods </li></ul><ul><ul><li>OnMessage </li></ul></ul><ul><ul><li>OnFault </li></ul></ul><ul><ul><li>OnError </li></ul></ul><ul><ul><li>onComplete </li></ul></ul>
  13. 13. Dynamic Client <ul><li>Creating a client on the fly </li></ul><ul><li>No need to provide an option object </li></ul><ul><li>Can use either ServiceClient or RPCServiceClient </li></ul><ul><li>ServiceClient client = new ServiceClient(null,new URL(&quot; http://localhost:8080/axis2/services/EchoService?wsdl &quot;),null,null); </li></ul><ul><li>OMElement response =client.sendReceive(newQName(&quot;http://ws.apache.org/axis2&quot;,&quot;sayHello&quot;),null); </li></ul>
  14. 14. Create a Client Using a WSDL <ul><li>First ensure you have </li></ul><ul><ul><li>SET AXIS2_HOME=c:axis2-1.5 </li></ul></ul><ul><ul><li>or similar (EXPORT, SETENV, etc) </li></ul></ul><ul><li>Command-line tool: </li></ul><ul><ul><li>wsdl2java.bat -uri http://localhost:8090/axis2/services/SampleService?wsdl -o H:Axis2-tutorialac-us-2009codegen </li></ul></ul><ul><li>Generates </li></ul><ul><ul><li>Ant Build script – build.xml </li></ul></ul><ul><ul><li>srcEchoServiceStub.java </li></ul></ul>
  15. 15. Client-side Session Handling <ul><li>ServiceClient supports invoking a service in a session aware manner </li></ul><ul><ul><li>In the case of a SOAP session, it will copy the required reference parameter </li></ul></ul><ul><ul><li>In the case of a transport session, it will copy the HTTP cookies </li></ul></ul><ul><li>Axis2, by default, copies the JSESSION cookie ID </li></ul><ul><li>If you want to change a custom cookie, then we need to specify the cookie name </li></ul><ul><li>options.setProperty(“customCookieID”,”SESSIONID”); </li></ul>
  16. 16. Session Aware Service <ul><li>There are four types </li></ul><ul><ul><li>Application </li></ul></ul><ul><ul><li>Transport </li></ul></ul><ul><ul><li>SOAP Session </li></ul></ul><ul><ul><li>Request </li></ul></ul><ul><li>Specifying a service scope </li></ul><ul><li><service scope=”application”> </service> </li></ul><ul><li>Accessing contexts </li></ul>
  17. 17. Adding a Web Resource <ul><li>Services can be deployed alone with a web resource (jsp , js , html etc) </li></ul><ul><li>When we have a web resource, we have to put them under the directory called 'WWW' </li></ul><ul><li>META-INF </li></ul><ul><li>services.xml </li></ul><ul><li>WWW </li></ul><ul><li>index.html </li></ul><ul><li>Upon deployment, you can access the resource using (if the service archive name is foo.aar) </li></ul><ul><ul><li>http://localhost:8080/axis2/foo </li></ul></ul>
  18. 18. Axis2 Module <ul><li>Modules are how Axis2 extends or provides quality of services </li></ul><ul><li>Implementation of WS-Specification </li></ul><ul><li>Can add support for a new specification in a simple and clean manner </li></ul><ul><li>Can deploy as a self contained package </li></ul><ul><li>Has own class loader module, so the module is also isolated </li></ul>
  19. 19. Axis2 Code Generation <ul><li>There are many options for data binding frameworks </li></ul><ul><ul><li>ADB </li></ul></ul><ul><ul><li>XMLbeans </li></ul></ul><ul><ul><li>JaxBri </li></ul></ul><ul><ul><li>JibX </li></ul></ul><ul><li>We can easily add a new data biding framework </li></ul>
  20. 20. Axis2 Pluggable Components <ul><li>Extending Axis2 deployment </li></ul><ul><ul><li>Custom deployers </li></ul></ul><ul><li>Axis2 observers </li></ul><ul><ul><li>Listen to Axis2 events </li></ul></ul><ul><li>Custom message receivers </li></ul><ul><ul><li>Talking to non-java class </li></ul></ul><ul><li>Adding a new transport </li></ul>
  21. 21. Writing Our Own Deployer <ul><li>There are a few things when developing a new deployer </li></ul><ul><ul><li>How to make something into an Axis2 component </li></ul></ul><ul><ul><ul><li>Service, Module or anything else </li></ul></ul></ul><ul><ul><li>How to remove that </li></ul></ul><ul><ul><li>How to populate an object correctly </li></ul></ul><ul><li>As an exercise, write a deployer to make a pure Java class into a service </li></ul>
  22. 22. Axis2 Observers <ul><li>Observing what happened inside AxisConfiguration </li></ul><ul><ul><li>Adding service </li></ul></ul><ul><ul><li>Changing service </li></ul></ul><ul><ul><li>Adding module </li></ul></ul><ul><ul><li>Changing module </li></ul></ul><ul><li>Observer will notify when the above events happen </li></ul><ul><li>Then the observer can act upon that </li></ul><ul><ul><li>WSO2 WASA atom and RSS feed generation </li></ul></ul>
  23. 23. Custom Message Receivers <ul><li>A message receiver is MEP dependent </li></ul><ul><li>A message receiver can be considered as the last handler of the in chain </li></ul><ul><li>You can write a Message receiver </li></ul><ul><ul><li>Invoke non Java class </li></ul></ul><ul><ul><ul><li>Java Script , Groovy etc... </li></ul></ul></ul><ul><ul><li>As a service </li></ul></ul><ul><ul><ul><li>You can deploy a service only with a MR </li></ul></ul></ul>
  24. 24. Adding a New Transport <ul><li>Adding a new transport framework is just a matter of </li></ul><ul><ul><li>Creating a TransportSender </li></ul></ul><ul><ul><li>Creating a TransportReceiver </li></ul></ul><ul><ul><li>Registering them in axis2.xml </li></ul></ul>
  25. 26. Want to Contribute ? <ul><li>Join axis-user and axis-dev list </li></ul><ul><li>Pick a JIRA and fix it </li></ul><ul><li>Send patches we will give you the commitership :) </li></ul>
  26. 27. Resources <ul><li>Axis2 official web site </li></ul><ul><ul><li>http://ws.apache.org/axis2 </li></ul></ul><ul><li>Presentation material </li></ul><ul><ul><li>http://people.apache.org/~deepal/ac_us_09 </li></ul></ul>

×