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

    Details

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

      Description

      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

          Activity

          mengugu Guillaume Menguy created issue -
          arjen.poutsma Arjen Poutsma made changes -
          Field Original Value New Value
          Fix Version/s 1.5.5 [ 11067 ]
          arjen.poutsma Arjen Poutsma made changes -
          Priority Critical [ 2 ] Major [ 3 ]
          arjen.poutsma Arjen Poutsma made changes -
          Link This issue is related to SWS-248 [ SWS-248 ]
          arjen.poutsma Arjen Poutsma made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          arjen.poutsma Arjen Poutsma added a comment - - edited

          Done, transforming to a intermediate buffer now. This might be slower, but at least it works for all WebServiceMessage implementations.

          Show
          arjen.poutsma Arjen Poutsma added a comment - - edited Done, transforming to a intermediate buffer now. This might be slower, but at least it works for all WebServiceMessage implementations.
          arjen.poutsma Arjen Poutsma made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Closing old issues

          Show
          arjen.poutsma Arjen Poutsma added a comment - Closing old issues
          arjen.poutsma Arjen Poutsma made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: