Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-412

PayloadTransformingInterceptor does not work with a DomPoxMessage - the transformation clears the document


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.4
    • Fix Version/s: 1.5.5
    • Component/s: Core
    • Labels:
    • Environment:
      Weblogic 9.2.2, Java 1.5_10


      This bug is related to SWS-248

      Emptying the Document in the method getPayloadResult() of the DomPoxMessage makes the transformation in the PayloadTransformingInterceptor impossible.

      PayloadTransformingInterceptor source code 1.5.4

      80 public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
      81 if (requestTemplates != null)

      { 82 WebServiceMessage request = messageContext.getRequest(); 83 Transformer transformer = requestTemplates.newTransformer(); 84 transformer.transform(request.getPayloadSource(), request.getPayloadResult()); 85 logger.debug("Request message transformed"); 86 }

      87 return true;
      88 }

      Line 84, before the transform() method is called, the 2nd argument evaluation clears the document inside the DomPoxMessage, so the DOMSource created by calling the 1st argument wraps now an empty document, the transformation returns always an empty XML.

      See my small test :
      public static void main(String[] args) throws IOException, TransformerFactoryConfigurationError, TransformerException

      { String content = "<element xmlns=\"http://www.springframework.org/spring-ws\" />"; byte[] bytes = content.getBytes("UTF-8"); InputStream input = new ByteArrayInputStream(bytes); DomPoxMessageFactory factory = new DomPoxMessageFactory(); DomPoxMessage domPoxMsg = (DomPoxMessage) factory.createWebServiceMessage(input); Result result = new StreamResult(System.out); Transformer t = TransformerFactory.newInstance().newTransformer(); System.out.println("1. Transformation to System.out :"); t.transform(domPoxMsg.getPayloadSource(), result); System.out.println("\n\n"); System.out.println("2. Transformation to message itself as Result (=interceptor)"); t.transform(domPoxMsg.getPayloadSource(), domPoxMsg.getPayloadResult()); System.out.println("\n\n"); System.out.println("3. Transformation to System.out :"); t.transform(domPoxMsg.getPayloadSource(), result); }

      The solution may be to add an intermediate transformation ( a simple StreamResult) but as it is working for other WebServiceMessage implementation ( SOAP ) it could be too heavy ...

      Note also that a testPayLoadInterceptor() could be added in DomPoxMessageTest

        Issue Links


          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          22d 2h 14m 1 Arjen Poutsma 01/Sep/08 11:14 PM
          In Progress In Progress Resolved Resolved
          3h 23m 1 Arjen Poutsma 02/Sep/08 2:38 AM
          Resolved Resolved Closed Closed
          1340d 4h 24m 1 Arjen Poutsma 04/May/12 7:03 AM


            • Assignee:
              arjen.poutsma Arjen Poutsma
              mengugu Guillaume Menguy
            • Votes:
              2 Vote for this issue
              3 Start watching this issue


              • Created: