Re: how to write a simple service

From: Arun Gupta <Arun.Gupta_at_Sun.COM>
Date: Wed, 15 Sep 2004 10:02:44 -0700

Hi Amit,

See inline reply ...

amit anand wrote:

> hello sir,
> Thanx for ur last the progress is that i have successfully executed wscompile and wsdeploy tools and i have successfully deployed the cooked war file in tomcat...
> Now the problem is that when i ran my client it is giving a strange error:
> This is my
> package add;
> public class AddClient {
> public static void main(String[] args) {
> try
> {
> AddIF st = (new AddService_Impl()).getAddIFPort();
> System.out.println("After Addition:"+st.doadd(10,20));
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
> }
> Now as ur wscompile command in ur 2nd article it generates only wsdl file but not the client and server stubs.As not generating the stubs i could'nt get the AddService_Impl file in order to call the doadd method
> after using wscompile once with -define it generates wsdl and afterthat in order to generate client and server stubs:
> So i have used wscomile to generate client as well as server stubs using -gen:client first and then -gen:server ...
Once the WSDL is generated, you need to use -gen:client on the WSDL to
generate the stubs. Ties will be generated once you bundle the portable
artifacts in the raw war file and feed it to wsdeploy.

> But while using -gen:client it gave a warning messaage that u have to use this option when starting with wsdl but i started from endpoint interface ....but anyway it still generated the client stubs and the second attempt for -gen:server executed successfully..
The recommended model to generate stubs is to start from a WSDL and
that's why this warning message is shown.

> Now on running my AddClient it gave the following error:
> access com.sun.xml.rpc.client.BasicService
> file com\sun\xml\rpc\client\BasicService.class not found
> AddIF st = (new AddService_Impl()).getAddIFPort();
> ^
> 1 error
> i could'nt able to got it what the error is???
Make sure jaxrpc-impl.jar and other related classes are in your
classpath when compiling your client. If you are using ant, the easiest
way is to use the ant bundled with JWSDP 1.4. Otherwise the list of jars
required in your classpath are listed at

> i have checked my service through my browser,,,it is perfectly working
> but the problem is in compiling client
> i know sir i am disturbing u a lot ,,,,but u can understand i am close to the result but still far....
> Thanx for ur cooperation
> waiting for an early response from ur side
Hopefully this will get you moving along.


> Regards
> -Amit

got Web Services ?
Download Java Web Services Developer Pack from
To unsubscribe, e-mail:
For additional commands, e-mail: