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. fantastic tutorial and very well explained, I've o
View Tutorial          By: Francis at 2011-08-14 19:57:18

2. Can you give some examples of do while & pleas
View Tutorial          By: mhilan at 2011-09-01 04:54:13

3. Very good.
But is this (Accessor functions

View Tutorial          By: peter at 2011-07-20 13:13:44

4. good one
View Tutorial          By: vij at 2009-06-03 16:00:12

5. good explanation .... Thanks
View Tutorial          By: nazeer at 2012-05-24 09:18:19

6. please send me the code of this movable clock and
View Tutorial          By: dafi at 2008-05-14 05:06:08

7. Nice work sir... it was very easy to understand ke
View Tutorial          By: AsadUllah at 2012-11-20 19:05:29

8. I need code for read write mifare 1k card using No
View Tutorial          By: amarendra at 2010-12-02 21:12:08

9. The only thing that really was the solution to my
View Tutorial          By: nick marinho at 2010-07-24 17:45:59

10. help to place a menu inside a menu
View Tutorial          By: sandy at 2009-07-29 05:57:28