WEBSERVICE USING APACHE AXIS TUTORIAL-1

Inter-operability is one of the two aims of Xml-webservice paradigm,while the other aim is tackling the firewall problem. (Since ASP.net runs only in Win2000, switch over to Win2000. before beginning this experiment).The emphasis is on the procedure, in l

WEBSERVICE USING APACHE AXIS TUTORIAL-1

WEBSERVICE USING APACHE AXIS TUTORIAL-1
Using Java XML-WEBSERVICE  from ASP.net.
( published in DeveloperIQ   January-2004)( www.developeriq.com)
R.S.RAMASWAMY ([email protected]) 

Sri.Manoj Kothale, has written a fine piece in DeveloperIQ(Nov'03) on  exposing an EJB as an XML-WebService, using Axis and JBOss. In this experiment, we attempt  exposing a javabean (jws)  from Tomcat/Axis and consuming that service in an ASP.net program.This is much simpler.

Inter-operability is one of the two aims of Xml-webservice paradigm,while the other aim is tackling the firewall problem. (Since ASP.net runs only in Win2000, switch over to Win2000. before beginning this experiment).The emphasis is on the procedure, in laboratory experiment fashion).

Kindly , ensure that correct versions of software , are used, as mentioned.It is presumed that DotNet SDK has already been installed and tested,for running asp.net programs.

   1)  axis1.1   was installed in c:\axis11

   2)  tomcat4.1  from march-2003 issue of Dev IQ.

                 was installed as c:\tomcat41 

   3)  We will  find a folder named 'axis' in c:\axiss11\webapps.

       Copy this ('axis') folder to  c:\tomcat41\webapps  folder.

   4)    We must copy  activation.jar  to:

          c:\tomcat41\webapps\axis\web-inf\lib   folder. (This file is available in jboss3.2\server\all\lib  folder

         and jboss3.2 was given in NovemberCD.)

       5)  We set JAVA_HOME  for tomcat as follows:

       c:\tomcat41\bin>set JAVA_HOME=D:\jdk141   (because, we have installed jdk1.4.1 in D-drive).

    6) We should uncomment the 'admin servlet' part in

      the web.xml  file in c:\tomcat41\webapps\axis\web-inf folder.

   7) We start tomcat server:

      c:\tomcat41\bin>startup

      8) This starts tomcat4.1 and we wait till, it is fully started.

    9) We create our own folder c:\axisdemo

      In this folder, we create a simple javabean   greeter.java   as given below. 

     //  c:\axisdemo\greeter.java 

       public class greeter

       {

          public String greetme(String s)

            {

             return "How are you???????.."+s;

            }

       }

   10) we copy  greeter.java as greeter.jws 0

       into           c:\tomcat41\webapps\axis    folder.

      (we did this while tomcat41 was running!).No problem!

    11)  We start the browser and type the URL as:               1

           'http://localhost:8080/axis/greeter.jws' 

           and we get  a link to the wsdl file for the above service. When we click this link, we get a wsdl file .

           (wsdl -> webservice description language). 2

     12) We save this   wsdl file  in  d:\inetpub\wwwroot  folder   as greeter.wsdl

     13)    Our aim is to create a C# file from this wsdl file.

          The following command does that.  3

         d:\inetpub\wwwroot>wsdl   greeter.wsdl 

         This command created  greeterService.cs  file! 

         ( carefully note that the name has been appended with  'Service')    4

         The next step is to compile this source file into a dll.   

    14)..wwwroot>csc /t:library  

              /r:System.dll,System.Web.Services.dll,System.Xml.dll 5

               greeterService.cs

           (type this in continuous line).  

          ( t -> target   &  r -> reference)    6

         This command created greeterService.dll 

    15) Now copy this dll file to  d:\inetpub\wwwroot\bin  folder.

   ( If there is no such 'bin' folder  create it.). 7

    Now create  greeterService.aspx  as given below.

    ( in d:\inetpub\wwwroot    folder)

<%@ page language="c#" %> 8

<script runat=server>

public void job1(Object o, EventArgs e)

{ 9

    String  a = text1.Text; 

    greeterService   greeter = new greeterService(); 

    String  s = greeter.greetme(a);  0

     Response.Write(s); 

} 

</script> 1

<html>

<body>

<form              runat=server> 2

  <asp:Textbox   id=?text1?                runat=server  />

  <asp:Button  onclick=job1  text="Click" runat=server   />

</form> 3

</body>

</html>

 ( Normally, IIS-5 will be running . If not, start it.) 4

 After this, type the URL in browser as: 

    'http://localhost/greeterService.aspx' 

    Remember that the tomcat server is running and supplying   the 'greeter.jws'. 5

After some delay ( due to compiling time), we get a form.Type your name in the textbox ( say, ?sam? )& click the button  to    invoke the service.  We get  'How are you??..sam?  message from the java web service. We get correct result .     We can also create a standalone C# client by just appending a main() to the greeterService.cs and naming it as  ?greeterConsole.cs?.

Ref:  AXIS..by RominIrani & JeelaniBasha (wrox press).  Tutorual-2  continues in axis2a.htm

Visit  http://in.geocities.com/rsramsam 6

Tutorials

  1. Apache Axis2 - Apache Axis2 Tutorial
  2. Why Web Services?
  3. Java Building a Simple Web Service ? A Tutorial Tutorial
  4. Apache Geronimo Application server Tutorial
  5. Apache Axis2 Tutorial, Develop the Next Generation of Apache Web Services using Apache Axis2
  6. SOA and Web Services
  7. Web Services Examples in NetBeans
  8. SOA and Web Services
  9. J2EE Web Service Development with Attachments Using Axis
  10. J2EE Web Service Development with Attachments Using Axis
  11. WEBSERVICE USING APACHE AXIS TUTORIAL-2 UNDERSTANDING APACHE AXIS
  12. Web Services - Web Services Tutorials
  13. Developing Axis Web services with XML Schemas.
  14. What is Service-Oriented Architecture?
  15. WEBSERVICE USING APACHE AXIS -TUTORIAL-2 UNDERSTANDING APACHE AXIS
  16. WEBSERVICE USING APACHE AXIS TUTORIAL-2 UNDERSTANDING APACHE AXIS (part-2)
  17. WEBSERVICE USING APACHE AXIS TUTORIAL-1
  18. WEBSERVICE USING APACHE AXIS TUTORIAL-2 UNDERSTANDING APACHE AXIS
  19. WEBSERVICE USING APACHE AXIS - TUTORIAL-2 AXIS FOR EJB-WEBSERVICE (part-5)
  20. Web Services Tutorials and Links
  21. WEBSERVICE USING APACHE AXIS TUTORIAL-2
  22. WEBSERVICE USING APACHE AXIS- TUTORIAL-2 J2ME CLIENT FOR EJB & EJB-WEBSERVICE
  23. Web Service
  24. Java Client webservice
  25. Ejb Webservice
  26. SOAP with Attachments API for Java
  27. SOAP Header
  28. WSDL program
  29. Application Using JAX-RPC
  30. Security in Web Service
  31. JAX-RPC Advance Concepts
  32. Database driven webservices
  33. Apache Axis2 - Apache Axis2 Tutorial
  34. Apache Axis2 Introduction
  35. Downloading and Installing Apache Axis2
  36. Apache Axis2 Hello World Example
  37. Axis2 client - Axis2 Client example
  38. Axis2 ant wsdl2java - Learn WSDL2java utility of Axis2 with example
  39. Axis2 Eclipse plugin Tutorial
  40. Installing axis2 eclipse plugin