5. Add the extrapolateAmountBid opera-
tion provided by the JAX-WS Web
service to the client classes:
. oracle.auctionAppWebService-
Client.controller.
private double extrapolateAmountBid
(double amountBid, int factor) {
com.bonbhel.oracle.au
ctionapp.ws.AuctionAppSOAPws
port = service.getAuctionAppSOAPwsPort();
return port.extrapolateAmountBid(amountBid, factor);
}
COMMUNITY
JAVA IN ACTION
See all listings as text
Figure 4
gration of RESTful Web services and
JAX-WS Web services in the same application allowed us to compare them so
we can choose the type of Web service
that best fits our needs.
NetBeans provide many tools and
services for creating Web services for
the client side and for consuming and
accessing over the network external
services that reside in the application
tier. </article>
ABOUT US
Figure 5
b. Put your cursor anywhere inside
the source editor.
c. Expand the Web Service
References node of the
AuctionAppWebServiceClient
project and drag the
extrapolateAmountBid node inside the
source editor.
Note: Alternatively, you can right-click
anywhere in the source editor and
choose Insert Code. Then select Call
Web Service Operation and click the
extrapolateAmountBid operation in
the Select Operation to Invoke
dialog box.
6. The extrapolateAmountBid() method
appears at the end of the BidController
class code, as shown in Listing 3.
7. We need to add some application
logic in the BidController class in
order to extrapolate the amount
of the bid (by factor, which is 100)
when the user is editing or viewing
the bid entry. So call the
extrapolateAmountBid operation
to extrapolate the bid:
a. Open the BidController.java file in
the source editor.
b. Modify the public String prepare-
View() method, as shown in
Listing 4.
Testing the Client Application
1. Run the JSF client application:
a. Make sure the AuctionApp we
started creating in Part 1 of this
series is up and running. If it is not,
right-click the AuctionApp node
and choose Deploy.
b. Right-click the
AuctionAppWebServiceClient
project and choose Run.
The list of all entries is displayed, as
shown in Figure 4.
2. Invoke the JAX-WS Web service to
display the extrapolated amount of
the bid:
a. Click the Show all Bid Items link
to display the list of bid entries, as
shown in Figure 5.
b. Click the View link of any Bid item
to see the newly extrapolated
amount of the bid. In our case it’s
Carolis’ Bid, as shown in Figure 6.
As you can see, the amount of
the bid changed from 800.0 to
80000.0.
c. Now you can smile, because it
works!
blog
Figure 6
Conclusion
We have seen how easy it is to configure
a JAX-WS Web service and consume it
from a JSF application client. The inte-
LEARN MORE
•;NetBeans documentation, training,
and support
•;”Developing JAX-WS Web Service Clients”
•;”Binding WSDL to Java with JAXB”
•;”Advanced Web Service Interoperability”
•;” Web Services Learning Trail”
•;Oracle University: Developing Web
Services Using Java Technology, Java EE 6