@Test public void testReturnPayload() throws Exception { Source source = new StringSource(PAYLOAD); MessageCreator responseCreator = new MessageCreator(source); WebServiceMessageFactory messageFactory = getMessageFactory(); SoapMessage response = (SoapMessage) responseCreator.createMessage(TEST_URI, null, messageFactory); Document generatedDocument = loadDocument(response.getPayloadSource()); XMLAssert.assertXMLEqual(loadDocument(source), generatedDocument); }
protected final WebServiceMessage createMessage(URI uri, WebServiceMessage input, WebServiceMessageFactory messageFactory) throws IOException { Source source = preprocessSource(uri, input, messageFactory); WebServiceMessage result; if (isSoap(source)) { result = messageFactory.createWebServiceMessage(getSourceAsStream(source)); } else { WebServiceMessage webServiceMessage = messageFactory.createWebServiceMessage(); transform(source, webServiceMessage.getPayloadResult()); result = webServiceMessage; } if (logger.isDebugEnabled()) { logger.debug("Generated message: "+serialize(getEnvelopeSource(result))); } return result; }
MessageCreator implements ResponseCreator, RequestCreator { protected final WebServiceMessage createMessage(URI uri, WebServiceMessage input, WebServiceMessageFactory messageFactory) throws IOException { Source source = preprocessSource(uri, input, messageFactory); WebServiceMessage result; if (isSoap(source)) { result = messageFactory.createWebServiceMessage(getSourceAsStream(source)); } else { WebServiceMessage webServiceMessage = messageFactory.createWebServiceMessage(); transform(source, webServiceMessage.getPayloadResult()); result = webServiceMessage; } if (logger.isDebugEnabled()) { logger.debug("Generated message: "+serialize(getEnvelopeSource(result))); } return result; } }
MessageCreator implements ResponseCreator, RequestCreator { protected final WebServiceMessage createMessage(URI uri, WebServiceMessage input, WebServiceMessageFactory messageFactory) throws IOException { Source source = preprocessSource(uri, input, messageFactory); WebServiceMessage result; if (isSoap(source)) { result = messageFactory.createWebServiceMessage(getSourceAsStream(source)); } else { WebServiceMessage webServiceMessage = messageFactory.createWebServiceMessage(); transform(source, webServiceMessage.getPayloadResult()); result = webServiceMessage; } if (logger.isDebugEnabled()) { logger.debug("Generated message: "+serialize(getEnvelopeSource(result))); } return result; } MessageCreator(Source sourceDocument); }
MessageCreator implements ResponseCreator, RequestCreator { protected final WebServiceMessage createMessage(URI uri, WebServiceMessage input, WebServiceMessageFactory messageFactory) throws IOException { Source source = preprocessSource(uri, input, messageFactory); WebServiceMessage result; if (isSoap(source)) { result = messageFactory.createWebServiceMessage(getSourceAsStream(source)); } else { WebServiceMessage webServiceMessage = messageFactory.createWebServiceMessage(); transform(source, webServiceMessage.getPayloadResult()); result = webServiceMessage; } if (logger.isDebugEnabled()) { logger.debug("Generated message: "+serialize(getEnvelopeSource(result))); } return result; } MessageCreator(Source sourceDocument); WebServiceMessage createResponse(URI uri, WebServiceMessage request, WebServiceMessageFactory messageFactory); WebServiceMessage createRequest(WebServiceMessageFactory messageFactory); final Source getSource(); }
MessageCreator implements ResponseCreator, RequestCreator { protected final WebServiceMessage createMessage(URI uri, WebServiceMessage input, WebServiceMessageFactory messageFactory) throws IOException { Source source = preprocessSource(uri, input, messageFactory); WebServiceMessage result; if (isSoap(source)) { result = messageFactory.createWebServiceMessage(getSourceAsStream(source)); } else { WebServiceMessage webServiceMessage = messageFactory.createWebServiceMessage(); transform(source, webServiceMessage.getPayloadResult()); result = webServiceMessage; } if (logger.isDebugEnabled()) { logger.debug("Generated message: "+serialize(getEnvelopeSource(result))); } return result; } MessageCreator(Source sourceDocument); WebServiceMessage createResponse(URI uri, WebServiceMessage request, WebServiceMessageFactory messageFactory); WebServiceMessage createRequest(WebServiceMessageFactory messageFactory); final Source getSource();  }