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



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 for your nice article.I learned a lot
View Tutorial          By: Mahyar at 2012-08-12 12:09:36

2. Hi its good for the learners and thosse who forgot
View Tutorial          By: Md.Abdul Gaffar at 2008-01-12 06:00:14

3. Hey nice article Brian W. Kernighan and/or Dennis
View Tutorial          By: butt at 2013-01-17 07:12:21

4. thnx, 4 ur explanation, that was usefl
but

View Tutorial          By: some1 at 2009-04-28 03:26:28

5. HI everyone,
I want to select par

View Tutorial          By: aarthi.s at 2011-09-06 10:09:16

6. How to Use Code in my Page ? plz give me the sugee
View Tutorial          By: jaty at 2015-08-19 12:25:20

7. I have successfully send sms after some trying....
View Tutorial          By: DILIP at 2012-01-19 14:38:50

8. #include<iostream>
#include<conio.

View Tutorial          By: XavioR at 2011-01-31 00:53:11

9. Thanks for the introduction of j2me
View Tutorial          By: AKbar Ali at 2009-10-19 03:56:58

10. well no one answered , i figured it out yesterday
View Tutorial          By: oded at 2008-09-29 00:32:16