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. thank's a lot for giving me " static "
View Tutorial          By: anwar kotawdekar at 2013-08-14 06:43:34

2. Hi,
tell me What is struts chaining with ex

View Tutorial          By: Mekala venkateswara at 2010-07-03 09:39:59

3. i don't use mysql,but oracle.
how to resolv

View Tutorial          By: Mike Zhu at 2009-06-23 19:20:06

4. Sorry Actually i used previous version of comm.jar
View Tutorial          By: A.Balaji at 2010-09-15 02:44:55

5. Hi Mirna,
U r talking abt speech to text co

View Tutorial          By: akshat at 2012-04-02 14:38:31

6. good example
View Tutorial          By: WANT TO KNOW WHY WE USE APPEND at 2011-06-14 00:39:48

7. Nice example..i m working on android and i want to
View Tutorial          By: Pranav at 2012-04-25 07:00:48

8. Hi,

I tried use this code:
<

View Tutorial          By: Yanosh at 2009-07-16 05:19:38

9. Thank you. This was a very annoying problem unti
View Tutorial          By: CBL at 2009-03-02 02:52:00

10. Hi Johnny,

did you check whether th

View Tutorial          By: Frank at 2010-11-13 13:16:57