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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content