Listing 6

public void doPost( HttpServletRequest request, HttpServletResponse response )
    throws IOException, ServletException
{
    try {
        String ret = "";
        // Read the request in as an XML string
        BufferedReader br = request.getReader() ;
        DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
        Document doc = xdb.parse( new InputSource(br) );

        // Get the SOAP envelope, which  contains the header and body
        Envelope env = Envelope.unmarshall( doc.getDocumentElement() );

        // Get the SOAP body, and create a Vector of body entries
        Body body = env.getBody();
        Vector bodyEntries = body.getBodyEntries();
		        
        // For the XML we're expecting, the body's 
        // root element should be the method name
        Enumeration e = bodyEntries.elements();
        Element elem = (Element)e.nextElement();

        // The child nodes of the root are the parameters
        NodeList nodes = elem.getChildNodes();
				
        // Get the method request name
        String requestName = elem.getNodeName();

        // Handle request
        ...

        // Send the response to the call
        sendSOAPResponse(requestName, ret, response);
    }
    catch ( Exception e ) {
        e.printStackTrace();
    }
}