Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

simplest webservice client ever

Thread view: 
ali - 05 May 2007 09:25 GMT
i have created a simple web service using tomcat and axis 1.4

it just has one method that returns the string hello world

i want create a client that would use this webservice

i tried some tutorials on the web but couldnt do it

can you please help
Richard Reynolds - 05 May 2007 12:36 GMT
>i have created a simple web service using tomcat and axis 1.4
>
[quoted text clipped - 5 lines]
>
> can you please help

My kitchen appliance is broke, can you help?
Are you willing to start quizzing me on the appliance make and model? what I
use it for? what it's doing? what it's supposed to be doing? what I've tried
so far? I think not.
ali - 06 May 2007 03:23 GMT
> My kitchen appliance is broke, can you help?
> Are you willing to start quizzing me on the appliance make and model? what I
> use it for? what it's doing? what it's supposed to be doing? what I've tried
> so far? I think not.

you was so helpful
Richard Reynolds - 06 May 2007 16:56 GMT
>> My kitchen appliance is broke, can you help?
>> Are you willing to start quizzing me on the appliance make and model?
[quoted text clipped - 4 lines]
>
> you was so helpful

Your question was so unhelpful, both for yourself and anyone wanting to
answer it. Try and think from other people's perspective when asking.
ali - 07 May 2007 05:30 GMT
Thanks for trying to help

i have got the answer i was looking for and created a tutorial of how
to create basic hello world like webservice and its java application
client

here it is if any one else is looking for semiller problems

all what you have to do is to

1- install java j2se 6

2- install tomcat 6

3- download Axis 1.4

4- unzip Axis 1.4

5- take the folder axis inside     "axis-bin-1_4\axis-1_4\webapps\"
folder
and copy pest it in "\Tomcat 6.0\webapps\"  folder

6- then search your computer for tools.jar file
it must be there somewhere depend on where is your java installed then
copy pest it in
"Tomcat 6.0\webapps\axis\WEB-INF\lib"

7-then run tomcat
and go to the browser and enter the link http://localhost:8080/axis/happyaxis.jsp
it should tell you all the needed componants are available

if so you are done and you can create a web service

8- just write a simple java programe and no need to compile it

just take the something.java file rename it to something.jws

put it in the folder  Tomcat 6.0\webapps\axis\

and then run in the browser

URL : http://localhost:8080/axis/something.jws

and then http://localhost:8080/axis/something.jws?wsdl

you will see WSDL of your java web service

your web service has bean created and it is working

9- create a client

9.1- you will need to find the following files (they must be in your
computer)
          axis.jar
          commons-discovery-0.2.jar
          commons-logging-1.0.4.jar
          jaxrpc-api.jar
9.2- add those file in the enviromental variable CLASSPATH
9.3- write your client program through this example client program

""
*
* Main.java
*
* Created on May 5, 2007, 11:28 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package serviceclient;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
/**
*
* @author Administrator
*/
public class Main {

   /** Creates a new instance of Main */
   public Main() {
   }

   /**
    * @param args the command line arguments
    */
   public static void main(String[] args) {
       try{

String endpoint = "http://localhost:8080/axis/something.jws";
String method = "sayit";   /// put your method name here

Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName(" http://localhost:8080/axis/something.jws",method)
);
String ret = (String) call.invoke(method,null); // instead of null
you can put array of the parameters you want to pass to the invoded
method
       System.out.println("Got result : " + ret);

}
catch(Exception err){}

   }

}

""

hope you good luck
Richard Reynolds - 07 May 2007 13:51 GMT
> Thanks for trying to help
>
[quoted text clipped - 112 lines]
>
> hope you good luck

Excellent post Ali, one of the things people often don't bother to do is to
post the solution once they've found it. I'm sure it will be very helpful to
many others.
caccamo.antonio@gmail.com - 05 May 2007 13:50 GMT
simply..use axis to create the client..

have u created the server.config file ??? have u inserted it under WEB-
INF directory ??

antanysavage

> i have created a simple web service using tomcat and axis 1.4
>
[quoted text clipped - 5 lines]
>
> can you please help
ali - 06 May 2007 03:24 GMT
On May 5, 4:50 pm, caccamo.anto...@gmail.com wrote:
> simply..use axis to create the client..
>
> have u created the server.config file ??? have u inserted it under WEB-
> INF directory ??
>
> antanysavage

no non of webservice tutorials that i read told me to create
server.config  what is it about and how it is used ?!!!
caccamo.antonio@gmail.com - 05 May 2007 13:50 GMT
simply..use axis to create the client..

have u created the server.config file ??? have u inserted it under WEB-
INF directory ??

antanysavage

> i have created a simple web service using tomcat and axis 1.4
>
[quoted text clipped - 5 lines]
>
> can you please help
R. Vince - 05 May 2007 14:33 GMT
Can I just do this in Tomcat though, and not use Axis?
Arne Vajhøj - 05 May 2007 15:50 GMT
> Can I just do this in Tomcat though, and not use Axis?

You use Axis with Tomcat !

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.