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. nice
View Tutorial          By: pran at 2013-07-16 05:03:19

2. nice overview on struts.....
View Tutorial          By: priyanka at 2010-08-23 00:13:33

3. The code is working for me as i have included &quo
View Tutorial          By: MOHAN at 2011-06-29 04:08:04

4. hey what If I'm connecting to a server(XMPP in my
View Tutorial          By: garima at 2015-08-10 13:23:40

5. hi!! friends i executed the code
and i am

View Tutorial          By: chennareddy at 2007-10-15 00:07:30

6. On my blog (http://www.future-edge.nl/blog/adding-
View Tutorial          By: Robert Willems at 2011-11-29 06:26:21

7. This one is helpful. Thanks

Is th

View Tutorial          By: Umesh Aawte at 2009-06-23 06:43:55

8. Hi All,

This SMS code is working fi

View Tutorial          By: Munavar at 2008-01-27 22:53:31

9. Dim xlApp As Excel.Application
Dim

View Tutorial          By: Zarno at 2010-12-24 07:11:19

10. hi
thanks for the above code
Anyone

View Tutorial          By: mjnanthini at 2010-09-29 00:59:01