Name

JAXMServlet

Synopsis

public abstract class JAXMServlet extends javax.servlet.http.HttpServlet {
// Public Constructors
    public JAXMServlet(  ); 
// Protected Class Methods
    protected static javax.xml.soap.MimeHeaders getHeaders(javax.servlet.http.HttpServletRequest req);
    protected static void putHeaders(javax.xml.soap.MimeHeaders headers, javax.servlet.http.HttpServletResponse res);
// Public Instance Methods
    public void setMessageFactory(javax.xml.soap.MessageFactory msgFactory);
// Public Methods Overriding HttpServlet
    public void doPost(javax.servlet.http.HttpServletRequest req,  javax.servlet.http.HttpServletResponse resp) 
        throws javax.servlet.ServletExceptionjava.io.IOException;
// Public Methods Overriding GenericServlet         
   public void init(javax.servlet.ServletConfig servletConfig)        
   throws javax.servlet.ServletException;
                  // Protected Instance Fields
    protected javax.xml.soap.MessageFactory msgFactory; 
}

JAXMServlet is a skeleton servlet that can be subclassed to create a container-resident JAXM client. The subclass must do the following:

  • Declare that it implements either the OnewayListener or ReqRespListener interface

  • Install a suitable MessageFactory in the init( ) method

  • Provide an implementation of the onMessage( ) method

A SOAP message is delivered to the servlet as an HTTP POST request and is therefore handled in the servlet’s doPost( ) method, which converts the body of the request to a javax.xml.soap.SOAPMessage object. This object is then passed to the onMessage( ) method, which ...

Get Java Web Services in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.