Java Reference
In-Depth Information
public class DefaultTicketWebService implements
TicketWebService, Serializable {
@Inject
private TheatreBox theatreBox;
@ WebMethod
@WebResult(name = "listSeats")
public List<SeatDto> getSeats() {
return theatreBox.getSeats()
.stream()
.map(SeatDto::fromSeat)
.collect(Collectors.toList());
}
@WebMethod
public void bookSeat(@WebParam(name = "seatId") int
seatId) {
theatreBox.buyTicket(seatId);
}
}
As you can see, the implementation class contains the getSeats method, which returns
the list of seats that are self-generated when the TheatreBox object is initialized. The
bookSeat method will be able to book seats for your web service clients as well.
Now deploy your web service and verify on the console that it has been correctly re-
gistered:
00:43:12,033 INFO [org.jboss.ws.cxf.metadata] (MSC service
thread 1-13) JBWS024061: Adding service endpoint metadata:
id=com.packtpub.wflydevelopment.chapter7.boundary.DefaultTicketWebService
address=http://localhost:8080/ticket-agency-ws/
TicketWebService
implementor=com.packtpub.wflydevelopment.chapter7.boundary.DefaultTicketWebService
serviceName={http://www.packtpub.com/}TicketWebService
portName={http://www.packtpub.com/
}DefaultTicketWebServicePort
Search WWH ::




Custom Search