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

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


      // 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

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.