How to effectively parse SOAP Message from http request ?

Solution Unverified - Updated -

Issue

  • We are parsing SOAPMessage from http request and we would like to know what is the better way to do it?
  • Should we read the request as string and than parse it with JaxB(there are many kind of requests) or there is a good way/class/library to do it?
  • We saw that there is a javax.xml.soap.SOAPMessage but it is more difficult to control it.
    We want to print the incoming message for debugging and also if the message is empty, the javax.xml.soap.SOAPMessage is throwing exception and we would like to avoid exceptions by checking if the http request is empty before parsing it (how can we do it? because when we read from the stream we can't move it later to the javax.xml.soap.SOAPMessage).

  • This is an example of what we are trying to do:

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    // before calling "messageFactory.createMessage()" would like to check if req.getInputStream() is empty in order not to get an exception from the messageFactory.createMessage() method
    boolean isEmptyInputStream = checkIfInputStreamIsEmpty(req.getInputStream());

    if (isEmptyInputStream==false){
        SOAPMessage soapMessage = messageFactory.createMessage(mimeHeaders, req.getInputStream());
    }

}

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x
  • JBossWS-CXF

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.