The JBossWS binary distribution comes with a samples testsuite covering the most important JAX-WS features. The samples allow user to practise with JAX-WS starting from small working applications. They can be deployed and run against any supported integration target and stack.
Users should be aware of samples that are shipped with the distribution since they can help them a lot both in getting started and understanding the most advanced JAX-WS features.
- Running the samples
Running the samples
To run the samples testsuite you need to have a properly installed JBossWS. Then simply run the tests through Ant:
cd jbossws-native-3.1.0.GA ant
This will build the samples and create their archives in the output/libs directory. Each sample usually has jar and war archives for client and server sides.
This will run the samples subset of the complete JBossWS testsuite. Make sure the AS is running before starting with the tests. The JBossWS test system will loop on the samples' collection:
- The server side archive is hot deployed on the configured JBoss application server.
- The client side test case is performed (this of course involves invoking the server endpoint).
- The server side archive is undeployed.
Please note that in order to run the tests you need JUnit libraries in your classpath. This can be achieved in different ways; refer to the or simply put the JUnit jar in your current Ant installation's lib directory.
Even if you can get an idea of each sample contents from the package name before looking at the code, a short description of the sample aims and covered technologies is provided below. A brief description of the sample's scenario is also provided whenever it makes sense.
In order to better understand the samples, you might take a look at the archives in the output/libs directory. Examine the archives' contents of the sample you're playing with and check which classes and descriptors are required on each side.
This sample shows different means of performing client asynchronous invocations. A simple echo operation is called, then the response is verified against the expected one. Timeouts allow the client to stop waiting for the response whenever the process takes too much time. Invocation examples are provided using both the and approach.
This sample aims at showing how to configure parameters. A web service with a given context root and requiring is exposed through EJB3 and POJO endpoints. Security domain and allowed roles are also specified.
This sample shows how to use handlers both on client and server side. Four handlers apply modifications to the soap body and header as well as to the mime headers. The test case invokes the web service endpoint and verifies that the result message is the expected one, i.e. all the handlers did their work in the right order. The test is performed both with a pre-defined client handler chain and a collection of handlers programmatically added to the binding provider.
This sample is almost the same as org.jboss.test.ws.jaxws.samples.provider except they use HTTPBinding.HTTP_BINDING binding type, i.e. simple xml messages go to the wire instead of SOAP messages.
A simple web service endpoint exposing a oneway method is invoked using a .
This sample's aim is to show the use of the approach. Two service endpoints work at message level dealing with entire SOAP requests/responses (Service.Mode.MESSAGE) obtained from JAXB marshalling of a given user type or directly from a text string. Another endpoint performs changes on the payload only. A is also configured to show how handlers can be used with provider/dispatch too.
An order management service is provided; it leverages credit card verification and profile management services to verify billing details and eventual customer discounts. The client send orders to the server that processes them and replies with their status. This sample uses most of the basic JAX-WS features as well as and .
This sample shows how to setup the security domain using the @SecurityDomain annotation available in the different target containers.
This sample shows how to deal with attachments using . Three endpoints with different soap binding styles have operations accepting and returning attachments through DataHandlers annotated with @XmlAttachmentRef.
This demonstrates the use of @WebParam annotation. The test case invokes an endpoint having operations with different kinds of parameters including INOUT and header.
This demonstrates the use of @WebResult annotation. A test web service endpoint provides customer's record given customer's name and address. The test case invokes the endpoint and verifies the result matches the expected customer's record.
This sample shows how to use the @WebService annotation. EJB3 and POJO endpoints both with generated and user-defined wsdl contracts receive invocations by the test case client.
This sample shows different ways of using the @WebServiceRef annotation. Multiple and single references both to Service classes and SEIs are used in EJB3, servlet and plain java class clients.
This sample shows how to use . MTOM is enabled through the @BindingType annotation both on a wrapped and a bare parameter style endpoints. Two test cases invoke echo operations on those endpoints both using binary-optimized requests and requests with inlined representation of the binary data.