Java Reference
In-Depth Information
The following listing contains the code for the
PlaceBid
web service. There are two parts
to this code: the interface for the web service and the stateless session bean.
Listing 8.2.
PlaceBid
In this listing, the
@WebService
annotation defines the interface as exposing a web
service. It also specifies the SOAP binding style: RPC encoded . The implementation
of the class also has the
@WebService
annotation with the
endpointInterface
ref-
erencing the web service interface ; the bean also implements that interface. The class
then implements the method being exposed
. Note that the
getBids
method
isn't
exposed because it doesn't appear in the interface.
If you have the ActionBazaar deployed in GlassFish, you can view the generated WSDL
at http://localhost:8080/PlaceBidService/PlaceBid?wsdl. Using the
wsimport
utility
provided by Java, you could generate a client that you can then use to invoke the service
programmatically. In the next example we'll explore the annotations in more depth.