ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Ws Wiki] Update of "FrontPage/Axis/WritingYourClient" by JohnMGabriele
Date Thu, 04 Aug 2005 14:31:53 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.

The following page has been changed by JohnMGabriele:
http://wiki.apache.org/ws/FrontPage/Axis/WritingYourClient

New page:
== Creating a client ==

If you know the url of a web service (possibly one of your own at, say for this example, {{{http://localhost:8080/axis/Bing.jws}}}),
and you want to write a client to use that web service, you can have Axis generate some Java
source code files for you to make your client code simpler:
{{{
java org.apache.axis.wsdl.WSDL2Java http://localhost:8080/axis/Bing.jws?wsdl
}}}
Whichever directory you run that `WSDL2Java` command in, inside it you'll now see `localhost/axis/Bing_jws`.
Inside `Bing_jws` you'll find 4 autogenerated .java files. '''Don't touch them.''' They are:

 * `Bing.java` -- an interface that extends `java.rmi.Remote` and declares some instance methods,
the names of which correspond to the instance methods you created in your `webapps/axis/Bing.jws`
file.

 * `BingService.java` -- another interface. This one extends `javax.xml.rpc.Service` and declares
`getBingAddress()`, `getBing()`, and `getBing( java.net.URL )`.

 * `BingServiceLocator.java` -- a class that extends `org.apache.axis.client.Service` and
implements `BingService`. You instaniate this class in your client. It's your `Service` object;
you tell it to `getBing()`, and it gives you a `Bing` object on which you may call those instance
methods you wrote in your `Bing.jws` class. :)

 * `BingSoapBindingStub` -- a class that extends `org.apache.axis.client.Stub` and implements
`Bing`.

Finally, to actually create your client, you'll need to create your own new class that makes
use of the ones listed above. It'll probably look something like:
{{{
import localhost.axis.Bing_jws.*;
public class MyBingClient
{
      public static void main( String args[] ) throws Exception
      {
            BingService service = new BingServiceLocator();
            Bing myBing = service.getBing();
            // call instance methods on myBing, ex., say, myBing.foo() 
      }
}
}}}

Mime
View raw message