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. thanks a lot man....
View Tutorial          By: Praveen at 2012-12-03 08:36:51

2. Very good explanation along with the example. Can
View Tutorial          By: Divya at 2010-09-21 03:05:10

3. Thanks great tutorial..
View Tutorial          By: Abul Rahman at 2009-07-24 11:39:52

4. Many thanks for your nice explanation.
View Tutorial          By: Zahra at 2012-04-10 06:03:56

5. My teacher doesnt teach me right!
View Tutorial          By: Anon at 2009-02-20 07:16:08

6. Thank you. I found this very helpful.
View Tutorial          By: tavella at 2014-09-26 01:04:13

7. im jst a begnr of it
and i hope it wl hlp m

View Tutorial          By: nitu at 2011-12-08 10:08:30

8. hi, i would like to know about sms sendimg via web
View Tutorial          By: abhi at 2008-07-09 07:28:54

9. hi sir
how can i get started if i want to

View Tutorial          By: simiyu at 2014-03-15 09:13:04

10. Cordial saludo, muchas gracias por ola ayuda pero
View Tutorial          By: Hernan Camilo Martínez at 2014-04-09 20:08:17