Package javax.xml.ws.handler

Examples of javax.xml.ws.handler.LogicalMessageContext


       
        MessageContext mc = new MessageContext();
        mc.setMEPContext(new MEPContext(mc));
        mc.setMessage(msg);
       
        LogicalMessageContext lmc = MessageContextFactory.createLogicalMessageContext(mc);
       
        return lmc;
    }
View Full Code Here


       
        MessageContext mc = new MessageContext();
        mc.setMEPContext(new MEPContext(mc));
        mc.setMessage(msg);
       
        LogicalMessageContext lmc = MessageContextFactory.createLogicalMessageContext(mc);
       
        return lmc;
    }
View Full Code Here

     * A test that mimics the inbound flow through a handler chain.
     */
    public void testInboundFaultFlow() throws Exception {
        MessageContext mc = createSampleFaultMessageContext();
       
        LogicalMessageContext lmc = MessageContextFactory.createLogicalMessageContext(mc);
        LogicalMessage lm = lmc.getMessage();
        Source payload = lm.getPayload();
        assertTrue("The returned payload (Source) was null", payload != null);
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        StreamResult result = new StreamResult(baos);
View Full Code Here

   public boolean appendHandlerName(MessageContext msgContext, String direction)
   {
      try
      {
         // Get the payload as Source
         LogicalMessageContext logicalContext = (LogicalMessageContext)msgContext;
         Source source = logicalContext.getMessage().getPayload();
         TransformerFactory tf = TransformerFactory.newInstance();
         ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
         tf.newTransformer().transform(source, new StreamResult(baos));

         // Parse the payload and extract the value
         Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));

         String oldValue = DOMUtils.getTextContent(root);
         String newValue = oldValue + ":" + direction + ":LogicalSourceHandler";
         root.setTextContent(newValue);

         log.debug("oldValue: " + oldValue);
         log.debug("newValue: " + newValue);

         // Set the updated payload
         source = new DOMSource(root);
         logicalContext.getMessage().setPayload(source);

         return true;
      }
      catch (RuntimeException rte)
      {
View Full Code Here

{

   @Override
   protected boolean handleInbound(MessageContext messageContext)
   {
      LogicalMessageContext context = (LogicalMessageContext)messageContext;
      LogicalMessage message = context.getMessage();
      Object payload = message.getPayload();
      if (!(payload instanceof DOMSource))
         throw new WSException("Test requires DOMSource payload");

      Node node = ((DOMSource)payload).getNode();
View Full Code Here

   @Override
   protected boolean handleInbound(final MessageContext msgContext)
   {
      log.info("handleInbound()");

      LogicalMessageContext lmc = (LogicalMessageContext)msgContext;
      LogicalMessage message = lmc.getMessage();

      Object payload = message.getPayload();

      if (payload instanceof DOMSource == false)
      {
View Full Code Here

   private boolean appendHandlerName(MessageContext msgContext, String direction)
   {
      try
      {
         // Get the payload as Source
         LogicalMessageContext logicalContext = (LogicalMessageContext)msgContext;
         JAXBContext jaxb = JAXBContext.newInstance(Echo.class.getPackage().getName());
         Object payload = logicalContext.getMessage().getPayload(jaxb);

         JAXBElement jaxbElement = null;
         if (payload instanceof JAXBElement)
         {
            jaxbElement = (JAXBElement)payload;
            payload = jaxbElement.getValue();
         }

         if (payload instanceof Echo)
         {
            Echo echo = (Echo)payload;
            String value = echo.getString1();
            echo.setString1(value + ":" + direction + ":LogicalJAXBHandler");
         }
         else if (payload instanceof EchoResponse)
         {
            EchoResponse echo = (EchoResponse)payload;
            String value = echo.getResult();
            echo.setResult(value + ":" + direction + ":LogicalJAXBHandler");
         }
         else
         {
            throw new WebServiceException("Invalid payload type: " + payload);
         }

         if (jaxbElement != null)
         {
            jaxbElement.setValue(payload);
            payload = jaxbElement;
         }

         // Set the updated payload
         logicalContext.getMessage().setPayload(payload, jaxb);

         return true;
      }
      catch (RuntimeException rte)
      {
View Full Code Here

   public boolean appendHandlerName(MessageContext msgContext, String direction)
   {
      try
      {
         // Get the payload as Source
         LogicalMessageContext logicalContext = (LogicalMessageContext)msgContext;
         Source source = logicalContext.getMessage().getPayload();
         TransformerFactory tf = TransformerFactory.newInstance();
         ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
         tf.newTransformer().transform(source, new StreamResult(baos));

         // Parse the payload and extract the value
         Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));

         String oldValue = DOMUtils.getTextContent(root);
         String newValue = oldValue + ":" + direction + "LogicalHandler";
         root.setTextContent(newValue);

         log.debug("oldValue: " + oldValue);
         log.debug("newValue: " + newValue);

         // Set the updated payload
         source = new DOMSource(root);
         logicalContext.getMessage().setPayload(source);

         return true;
      }
      catch (RuntimeException rte)
      {
View Full Code Here

   private boolean appendHandlerName(MessageContext msgContext, String direction)
   {
      try
      {
         // Get the payload as Source
         LogicalMessageContext logicalContext = (LogicalMessageContext)msgContext;
         Source source = logicalContext.getMessage().getPayload();
         TransformerFactory tf = TransformerFactory.newInstance();
         ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
         tf.newTransformer().transform(source, new StreamResult(baos));

         // Parse the payload and extract the value
         Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
         Element element = DOMUtils.getFirstChildElement(root);

         String oldValue = DOMUtils.getTextContent(element);
         String newValue = oldValue + ":" + direction + ":LogicalSourceHandler";
         element.setTextContent(newValue);

         log.debug("oldValue: " + oldValue);
         log.debug("newValue: " + newValue);

         // Set the updated payload
         source = new DOMSource(root);
         logicalContext.getMessage().setPayload(source);

         return true;
      }
      catch (RuntimeException rte)
      {
View Full Code Here

   private boolean appendHandlerName(MessageContext msgContext, String direction)
   {
      try
      {
         // Get the payload as Source
         LogicalMessageContext logicalContext = (LogicalMessageContext)msgContext;
         Source source = logicalContext.getMessage().getPayload();
         TransformerFactory tf = TransformerFactory.newInstance();
         ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
         tf.newTransformer().transform(source, new StreamResult(baos));

         // Parse the payload and extract the value
         Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
         Element element = DOMUtils.getFirstChildElement(root);

         String oldValue = DOMUtils.getTextContent(element);
         String newValue = oldValue + ":" + direction + ":LogicalSourceHandler";
         element.setTextContent(newValue);

         log.debug("oldValue: " + oldValue);
         log.debug("newValue: " + newValue);

         // Set the updated payload
         source = new DOMSource(root);
         logicalContext.getMessage().setPayload(source);

         return true;
      }
      catch (RuntimeException rte)
      {
View Full Code Here

TOP

Related Classes of javax.xml.ws.handler.LogicalMessageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.