Comment on Tutorial - Java WebService - Create your first web service in Java By Emiley J



Comment Added by : Carlos Kassab

Comment Added at : 2015-02-20 17:18:06

Comment on Tutorial : Java WebService - Create your first web service in Java By Emiley J
This is just the web service, if you want to consume it, you need to create a program to consume it

java javamples.one.TimeServerPublisher

Do not close the publisher and go to folder javasamples/one

run the next command:

wsimport -s . http://127.0.0.1:9876/one?wsdl

It will create a structure of java files and will compile them.

Create file javasamples/one/TimeClient.java

Copy this content inside file TimeClient.java :
import javasamples.one.TimeServer;
import javasamples.one.TimeServerImplService;

public class TimeClient {

/**
* @author Carlos Kassab
*/
public static void main(String[] args) {

TimeServerImplService timeServerService = new TimeServerImplService();
TimeServer timeServer = timeServerService.getTimeServerImplPort();
System.out.println(timeServer.getTimeAsString());
}
}

From the command window, go to folder javasamples/one
Compile program TimeClient.java: javac TimeClient.java

Run program: java TimeClient.java
You should see something like this: Fri Feb 20 11:10:57 CST 2015


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. This is a great tutorial. I have a slight problem,
View Tutorial          By: Vix at 2010-11-22 13:42:03

2. nice tutorial
View Tutorial          By: Rakesh at 2012-05-30 01:13:00

3. A more complete description of the common pitfalls
View Tutorial          By: Phil at 2012-11-25 02:06:49

4. i am getting a force close...can anyone please hel
View Tutorial          By: jack at 2012-03-22 15:18:37

5. Good Article. Small and Sweet...
View Tutorial          By: Anupam Pawar at 2009-05-27 03:04:08

6. It was actually useful!!! Thanks for explaining in
View Tutorial          By: steph at 2010-01-28 21:59:06

7. Great Thanks
View Tutorial          By: anawaz at 2012-10-05 10:28:20

8. Fantastic Post, can u pls tell me how can i pass q
View Tutorial          By: Kunal at 2012-08-07 07:02:41

9. Hey, this is a great explanation regarding the dif
View Tutorial          By: foam roofing at 2011-04-02 17:26:52

10. i want to know more sample codes in object oriente
View Tutorial          By: glades at 2013-01-23 08:28:33