Code example for DOMResult

Methods: getNode

0
      DOMSource request = new DOMSource(newDoc);
      // Below works for both CXF and Metro: 
      Dispatch<Source> disp = jaxwsService.createDispatch(portName,
            Source.class, Service.Mode.PAYLOAD);
      Source result = disp.invoke(request);
      DOMResult domResponse = new DOMResult();
      Transformer trans = TransformerFactory.newInstance().newTransformer();
      trans.transform(result, domResponse);
      assertEquals("Double-It failing with prime numbers", "14", domResponse
            .getNode().getFirstChild().getTextContent().trim());
 
      /* Simpler CXF-only alternative that uses Dispatch<DOMSource>:  
      Dispatch<DOMSource> disp = jaxwsService.createDispatch(portName, DOMSource.class, 
         Service.Mode.PAYLOAD);  
      DOMSource domResponse = disp.invoke(request); 
      assertEquals("Double-It failing with prime numbers", "14", 
         domResponse.getNode().getFirstChild().getTextContent().trim()); */ 
   } 
 
   /* 
Contextual code suggestions in your IDE  Get Codota for Java