Java Reference
In-Depth Information
assertTrue(list.size() > 0);
assertTrue(list.get(1).isBooked());
}
}
As you can see, the native Apache CXF client is pretty short in code and requires just
one class named
JaxWsProxyFactoryBean
to get instantiated. This class handles
the hard job of binding the SEI to a local proxy using the
setProxyClass
method.
In order to read the web service contract, you need to provide the WSDL location (in
our example, it is
http://localhost:8080/ticket-agency-ws/TicketWe-
bService?wsdl
) using the
setAddress
method.
Optionally, you can bind a set of
logging interceptors
to your web service endpoint
to debug your web services.
Note
Apache CXF uses Java SE logging for both the client and server-side logging of
SOAP requests and responses behind the scenes. Logging is activated by the
use of separate in/out interceptors that can be attached to the client and/or ser-
vice as shown in the previous code.
Finally, the
create
method of your JAX-WS factory will return a proxy to your web
service that can be used for testing two basic operations: booking a seat and check-
ing from the
Seat
list if the seat has actually been reserved.
Compiling the example
In order to compile this client, you need to add the following Apache CXF dependen-
cies to your
pom.xml
file: