Services | Updates | Contact
Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
Search All Tutorials
Top Search: Loan Struts Open Source
Database books Page20
Introduction of Oracle XML Cheatsheet Oracle posesses a variety of powerful XML features. A tremendous amount of docume
 
Java Applet - Creating First Applet Example
First of all we will know about the applet. An applet is a program written in java programming language and embedded wit
 
More Tutorials...

Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

 
 
Web Services
Comments
 
 

 

WEBSERVICE USING APACHE AXIS TUTORIAL-2
Accessing ejb-webservice  using  WAP (Wireles-Application Protocol)
R.S.RAMASWAMY (rs.ramaswamy@gmail.com)

c:\sam> edit ejbaxiswapservlet.java

******************************************

//ejbaxiswapservlet.java

----------------------

import java.net.URL;

import org.apache.axis.client.Service;

import org.apache.axis.client.Call;

import org.apache.axis.encoding.XMLType;

import javax.xml.rpc.ParameterMode;

import javax.xml.namespace.QName;

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

public class ejbaxiswapservlet extends HttpServlet

{

    public void doPost (HttpServletRequest request,  

                        HttpServletResponse response)

                 throws ServletException, IOException

    {

      response.setContentType("text/vnd.wap.wml");

        PrintWriter out = response.getWriter();

        String sql = request.getParameter("text1");

        try{

            String url = "http://localhost:8080/axis/services/sqlservice";

            String method = "getdata";

            Service   service = new Service();

 Call     call = (Call) service.createCall();

      call.setTargetEndpointAddress ( url);

      call.setOperationName

             ( new QName("sqlservice",method));

         call.addParameter("sql",XMLType.XSD_STRING,ParameterMode.IN);

    call.setReturnType(XMLType.XSD_STRING);

            System.out.println("Call Ok");

  Object[] params = new Object[] { args[0] };

       System.out.println("Params ok...");

     String s = (String) call.invoke(params);

         System.out.println(s);

      out.println("<p>");

      out.println("ejb with wap<br/>");

      out.println(s);

      out.println("</p>");

      out.println("</card>");

      out.println("</wml>");

        }catch(Exception e)

                { System.out.println(""+e);  }

    }

}

********************************************

Complie and copy  the class file to  tomcat as below.

 

c:\sam> javac ejbaxiswapservlet.java 

copy c:\sam\ejbaxiswapservlet.class  to

     d:\tomcat 4.1\webapps\axis\web-inf\classes

Edit web.xml in 

  d:\tomcat 4.1\webapps\axis\web-inf folder 

      <servlet>

     <servlet-name>

        ejbaxiswapservlet

       </servlet-name>

     <servlet-class>

     ejbaxiswapservlet

     </servlet-class>

     </servlet>

     <servlet-mapping>

<servlet-name>

ejbaxiswapservlet

</servlet-name>

<url-pattern>

     \servlet\ejbaxiswapservlet

 </url-pattern>

     </servlet-mapping>

For accessing servlet, create a wml file in the working folder

and copy the file to

d:\tomcat 4.1\webapps\axis

c:\sam> edit ejbaxiswapservlet.wml

***************************************************

ejbaxiswapservlet.wml

---------------------

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC

 "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

   <card id="card1">

     <p>      

Query? <input type="text"  name="text1"   />  

   <do   type="accept">

   <go  method="post" href="http://localhost:8080/axis/servlet/ejbaxiswapservlet"> 

           <postfield name="text1"  value="$text1"/>

   </go>

   </do>

   </p>            

   </card>

</wml>

*************************************************

Open 'Microsoft Mobile browser'and type the url as

'http://localhost:8080/axis/ejbaxiswapservlet.wml'

Make sure that tomcat is running. Enter sql query in the text box and submit it. we'll get the resultset as per the query. But, WAP is no-longer, the favoured wireless client because of limited functionality. Color graphics, games and animations are expected today. 

J2ME is the best solution for such apps, because,it is platform independent.

We now demonstrate how we can access an ejb-webservice from a j2me wireless client.( continued in axis3-3.htm

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

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

0 comments so far (post your own) View All Comments Latest 10 Comments:

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.