[JAX-WS] Simple Dispatch Client Example

Here is an example of a Dispatch type Java SE WebService client. 1. A sample Web Service (Running as a Dynamic Web Application in Glassfish):

  2. Here is the client (A simple Java SE application). Make sure to start the previous application first:

This will generate a SOAP request like:


Low Level SOAP manipulation and JAX-WS invokation (SAAJ)

1. The Client Code

2. The server (a very simple Dynamic Web App in eclipse running on Glassfish):

3. Invokation results: 3.1. Request

3.2. Response

[JAX-WS] 3 ways to enable MTOM in JAX-WS on the server side

1. Enable using @javax.xml.ws.soap.MTOM annotation on the endpoint implementation class

2. MTOM can be also be enabled on an endpoint by specifying enable-mtom attribute to true on an endpoint element in sun-jaxws.xml deployment descriptor.

3. Enable using @BindingType on the endpoint (SEI) implementation class

will enable MTOM on the deployed endpoint for…

[JAX-WS] (Metro) 3 ways to customize package in WSDL

By default wscompile generates WSDL artifacts in a package computed from the WSDL targetNamespace. For example, a WSDL file with the targetNamespace http://duke.example.org without any package customization will be mapped to the org.duke package. To customize the default package mapping you would use a jaxws:package customization on the wsdl:definitions node or it can directly appear…

[JAX-WS] Simple webservice and client

1. Create a new Dynamic Web Project LibraryWS. 2. Create a package webservice 3. Create a class BookWebService

4. Create a class Book

5. Run on Server (Glassfish!). 6. You should be able to access the service here: http://localhost:8080/LibraryWs/BookWebServiceService 7. Go to http://localhost:8080/LibraryWs/BookWebServiceService?wsdl for the wsdl (copy this URL) 8. Create a new…

[JAX-WS] @HandlerChain example with unit test

JAX-WS @WebService component use a handler chain to alter incoming and outgoing SOAP messages. SOAP Handlers are similar to Servlet Filters or EJB/CDI Interceptors. 1. Project Layout (you can create an example WebService project) 2. LogService interface (this is the interface for our web service)

3. The implementing class

4. Handlers.xml (in the…