public void writeBody(ActionRequestMessage requestMessage, ActionInvocation actionInvocation) throws UnsupportedDataException { log.fine("Writing body of " + requestMessage + " for: " + actionInvocation); try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); Document d = factory.newDocumentBuilder().newDocument(); Element body = writeBodyElement(d); writeBodyRequest(d, body, requestMessage, actionInvocation); if (log.isLoggable(Level.FINER)) { log.finer( "===================================== SOAP BODY BEGIN ============================================"); log.finer(requestMessage.getBodyString()); log.finer( "-===================================== SOAP BODY END ============================================"); } } catch (Exception ex) { throw new UnsupportedDataException("Can't transform message payload: " + ex, ex); } }
public void readBody(ActionRequestMessage requestMessage, ActionInvocation actionInvocation) throws UnsupportedDataException { log.fine("Reading body of " + requestMessage + " for: " + actionInvocation); if (log.isLoggable(Level.FINER)) { log.finer( "===================================== SOAP BODY BEGIN ============================================"); log.finer(requestMessage.getBodyString()); log.finer( "-===================================== SOAP BODY END ============================================"); } String body = getMessageBody(requestMessage); try { DocumentBuilderFactory factory = createDocumentBuilderFactory(); factory.setNamespaceAware(true); DocumentBuilder documentBuilder = factory.newDocumentBuilder(); documentBuilder.setErrorHandler(this); Document d = documentBuilder.parse(new InputSource(new StringReader(body))); Element bodyElement = readBodyElement(d); readBodyRequest(d, bodyElement, requestMessage, actionInvocation); } catch (Exception ex) { throw new UnsupportedDataException("Can't transform message payload: " + ex, ex, body); } }