Package org.jboss.ws.core.jaxws.handler

Examples of org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS


   // Invoked by the proxy invokation handler
   public Object invoke(QName opName, Object[] args, Map<String, Object> resContext) throws RemoteException
   {
      // Associate a message context with the current thread
      CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
      MessageContextAssociation.pushMessageContext(msgContext);

      // The contents of the request context are used to initialize the message context (see section 9.4.1)
      // prior to invoking any handlers (see chapter 9) for the outbound message. Each property within the
      // request context is copied to the message context with a scope of HANDLER.
      Map<String, Object> reqContext = getBindingProvider().getRequestContext();
      msgContext.putAll(reqContext);

      try
      {
         Object retObj = invoke(opName, args, false);
         return retObj;
      }
      catch (Exception ex)
      {
         OperationMetaData opMetaData = getOperationMetaData();
         if (opMetaData.isOneWay())
         {
            handleOneWayException(opMetaData, ex);
         }
         else
         {
            handleRemoteException(opMetaData, ex);
         }
         return null;
      }
      finally
      {
         // Copy the inbound msg properties to the binding's response context
         msgContext = MessageContextAssociation.peekMessageContext();
         for (String key : msgContext.keySet())
         {
            Object value = msgContext.get(key);
            resContext.put(key, value);
         }

         // Reset the message context association
         MessageContextAssociation.popMessageContext();
View Full Code Here


   // Invoked by the proxy invokation handler
   public Object invoke(QName opName, Object[] args, Map<String, Object> resContext) throws RemoteException
   {
      // Associate a message context with the current thread
      CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
      msgContext.setConfig(this.epConfigMetaData.getConfig());
      MessageContextAssociation.pushMessageContext(msgContext);

      try
      {
         // The contents of the request context are used to initialize the message context (see section 9.4.1)
         // prior to invoking any handlers (see chapter 9) for the outbound message. Each property within the
         // request context is copied to the message context with a scope of HANDLER.
         Map<String, Object> reqContext = getBindingProvider().getRequestContext();

         msgContext.putAll(reqContext);

         try
         {
            Object retObj = invoke(opName, args, false);
            return retObj;
         }
         catch (Exception ex)
         {
            OperationMetaData opMetaData = getOperationMetaData();
            if (opMetaData.isOneWay())
            {
               handleOneWayException(opMetaData, ex);
            }
            else
            {
               handleRemoteException(opMetaData, ex);
            }
            return null;
         }
         finally
         {
            msgContext = MessageContextAssociation.peekMessageContext();


            // Copy the inbound msg properties to the binding's response context
            for (String key : msgContext.keySet())
            {
               Object value = msgContext.get(key);
               resContext.put(key, value);
            }
         }
      }
      finally
View Full Code Here

   // Invoked by the proxy invokation handler
   public Object invoke(QName opName, Object[] args, Map<String, Object> resContext) throws RemoteException
   {
      // Associate a message context with the current thread
      CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
      MessageContextAssociation.pushMessageContext(msgContext);

      try
      {
         // The contents of the request context are used to initialize the message context (see section 9.4.1)
         // prior to invoking any handlers (see chapter 9) for the outbound message. Each property within the
         // request context is copied to the message context with a scope of HANDLER.
         Map<String, Object> reqContext = getBindingProvider().getRequestContext();

         msgContext.putAll(reqContext);

         try
         {
            Object retObj = invoke(opName, args, false);
            return retObj;
         }
         catch (Exception ex)
         {
            OperationMetaData opMetaData = getOperationMetaData();
            if (opMetaData.isOneWay())
            {
               handleOneWayException(opMetaData, ex);
            }
            else
            {
               handleRemoteException(opMetaData, ex);
            }
            return null;
         }
         finally
         {
            msgContext = MessageContextAssociation.peekMessageContext();


            // Copy the inbound msg properties to the binding's response context
            for (String key : msgContext.keySet())
            {
               Object value = msgContext.get(key);
               resContext.put(key, value);
            }
         }
      }
      finally
View Full Code Here


   public void testWsaAction() throws Exception
   {
      WSAddressingClientHandler wsHandler = new WSAddressingClientHandler();
      SOAPMessageContextJAXWS context = new SOAPMessageContextJAXWS();
      context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new Boolean(true));
      context.put(BindingProvider.SOAPACTION_URI_PROPERTY, "inputAction");
      context.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, new SOAPAddressingPropertiesImpl());
      context.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, new SOAPAddressingPropertiesImpl());
      MessageFactory factory = MessageFactory.newInstance();
      SOAPMessage soapMsg = factory.createMessage();
      context.setMessage(soapMsg);
      wsHandler.handleMessage(context);
      SOAPAddressingProperties addrProps = (SOAPAddressingProperties)context.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
      assertEquals(addrProps.getAction().getURI().toString(), "inputAction");
     
   }
View Full Code Here

        focus.setModel("Focus");
        focus.setColor("White");
        cars.add(focus);
        response.setReturn(cars);
       
        SOAPMessageContextJAXWS messageContext = new SOAPMessageContextJAXWS();
        QName portTypeName = new QName("http://jbossws.jboss.org", "GetSedans");
        EndpointMetaData endpointMetaData = new MockEndpointMetaData(portTypeName);
        messageContext.setEndpointMetaData(endpointMetaData);
        MessageContextAssociation.pushMessageContext(messageContext);
        BufferedStreamResult result = (BufferedStreamResult)serializer.serialize(qname, null, response, context, null);
        Element element = DOMUtils.parse(result.toString());
        List<Element> elements = DOMUtils.getChildElementsAsList(element, "return");
        for (Element ele : elements)
View Full Code Here

      // Get the order of pre/post handlerchains
      HandlerType[] handlerType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST };
      HandlerType[] faultType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST };

      // Associate a message context with the current thread
      CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
      MessageContextAssociation.pushMessageContext(msgContext);
      try
      {
         msgContext.setEndpointMetaData(epMetaData);
         msgContext.setSOAPMessage(reqMsg);
         msgContext.putAll(reqContext);
         // Try to find out the operation metadata corresponding to the message we're sending
         msgContext.setOperationMetaData(getOperationMetaData(epMetaData,reqMsg));

         // The contents of the request context are used to initialize the message context (see section 9.4.1)
         // prior to invoking any handlers (see chapter 9) for the outbound message. Each property within the
         // request context is copied to the message context with a scope of HANDLER.
         msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);

         QName portName = epMetaData.getPortName();
         try
         {
            // Call the request handlers
            boolean handlerPass = callRequestHandlerChain(portName, handlerType[0]);
            handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[1]);
            handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[2]);

            XOPContext.visitAndRestoreXOPData();

            // Handlers might have replaced the message
            reqMsg = (SOAPMessageImpl)msgContext.getSOAPMessage();

            MessageAbstraction resMsg = null;
            if (handlerPass)
            {
               Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
               if (callProps.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) {
                  targetAddress = (String) callProps.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
               }
               EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
               resMsg = getRemotingConnection().invoke(reqMsg, epInfo, false);

               //Pivot, switch to response ctx and save the response message there
               msgContext = MessageContextJAXWS.processPivot(msgContext);
               msgContext.setMessageAbstraction(resMsg);

               // Call the  response handler chain, removing the fault type entry will not call handleFault for that chain
               handlerPass = callResponseHandlerChain(portName, handlerType[2]);
               faultType[2] = null;
               handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[1]);
View Full Code Here

      return response;
   }

   public void invokeOneWay(T msg)
   {
      CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
      MessageContextAssociation.pushMessageContext(msgContext);
      try
      {
         msgContext.setEndpointMetaData(epMetaData);
         MessageAbstraction reqMsg = getRequestMessage(msg);
         String targetAddress = epMetaData.getEndpointAddress();
         getRemotingConnection().invoke(reqMsg, targetAddress, true);
      }
      catch (Exception ex)
View Full Code Here

         msgContext = new SOAPMessageContextJAXRPC();
         invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext);
      }
      else
      {
         msgContext = new SOAPMessageContextJAXWS();
         msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, Boolean.valueOf(false));
         msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
         invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
      }
View Full Code Here

         msgContext = new SOAPMessageContextJAXRPC();
         invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext);
      }
      else
      {
         msgContext = new SOAPMessageContextJAXWS();
         msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, Boolean.valueOf(false));
         msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
         msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
         invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
      }
View Full Code Here

         msgContext = new SOAPMessageContextJAXRPC();
         invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext);
      }
      else
      {
         msgContext = new SOAPMessageContextJAXWS();
         msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, Boolean.valueOf(false));
         msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
         invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
      }
View Full Code Here

TOP

Related Classes of org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS

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.