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

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


/* 226 */       CommonMessageContext msgContext = new SOAPMessageContextJAXRPC();
/* 227 */       invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext);
/*     */     }
/*     */     else
/*     */     {
/* 231 */       msgContext = new SOAPMessageContextJAXWS();
/* 232 */       msgContext.put("javax.xml.ws.handler.message.outbound", new Boolean(false));
/* 233 */       msgContext.put("javax.xml.ws.binding.attachments.inbound", new HashMap());
/* 234 */       invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
/*     */     }
/*     */
View Full Code Here


/* 202 */     mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
/*     */
/* 205 */     UnifiedHandlerMetaData.HandlerType[] handlerType = { UnifiedHandlerMetaData.HandlerType.PRE, UnifiedHandlerMetaData.HandlerType.ENDPOINT, UnifiedHandlerMetaData.HandlerType.POST };
/* 206 */     UnifiedHandlerMetaData.HandlerType[] faultType = { UnifiedHandlerMetaData.HandlerType.PRE, UnifiedHandlerMetaData.HandlerType.ENDPOINT, UnifiedHandlerMetaData.HandlerType.POST };
/*     */
/* 209 */     CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
/* 210 */     MessageContextAssociation.pushMessageContext(msgContext);
/* 211 */     msgContext.setEndpointMetaData(this.epMetaData);
/* 212 */     msgContext.setSOAPMessage(reqMsg);
/* 213 */     msgContext.putAll(reqContext);
/*     */
/* 218 */     msgContext.put("javax.xml.ws.handler.message.outbound", Boolean.TRUE);
/*     */
/* 220 */     QName portName = this.epMetaData.getPortName();
/*     */     try
/*     */     {
/* 224 */       boolean handlerPass = callRequestHandlerChain(portName, handlerType[0]);
/* 225 */       handlerPass = (handlerPass) && (callRequestHandlerChain(portName, handlerType[1]));
/* 226 */       handlerPass = (handlerPass) && (callRequestHandlerChain(portName, handlerType[2]));
/*     */
/* 229 */       reqMsg = (SOAPMessageImpl)msgContext.getSOAPMessage();
/*     */
/* 231 */       MessageAbstraction resMsg = null;
/* 232 */       if (handlerPass)
/*     */       {
/* 234 */         Map callProps = new HashMap(getRequestContext());
View Full Code Here

      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();
      CommonMessageContext reqMsgContext = msgContext;
      MessageContextAssociation.pushMessageContext(msgContext);
      try
      {
         msgContext.setEndpointMetaData(epMetaData);
         msgContext.setSOAPMessage(reqMsg);
         msgContext.putAll(reqContext);
         configureMTOM(msgContext, reqMsg);
         // 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

/*  72 */     log.debug("unbindRequestMessage: " + opMetaData.getQName());
/*     */     try
/*     */     {
/*  76 */       EndpointInvocation epInv = new EndpointInvocation(opMetaData);
/*     */
/*  78 */       SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
/*  79 */       if (msgContext == null) {
/*  80 */         throw new WSException("MessageContext not available");
/*     */       }
/*  82 */       ParameterMetaData paramMetaData = (ParameterMetaData)opMetaData.getParameters().get(0);
/*  83 */       QName xmlName = paramMetaData.getXmlName();
View Full Code Here

/*     */     throws BindingException
/*     */   {
/*  98 */     log.debug("bindResponseMessage: " + opMetaData.getQName());
/*     */     try
/*     */     {
/* 101 */       SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
/* 102 */       if (msgContext == null) {
/* 103 */         throw new WSException("MessageContext not available");
/*     */       }
/*     */
/* 106 */       MessageAbstraction resMessage = (MessageAbstraction)epInv.getReturnValue();
/* 107 */       msgContext.setMessageAbstraction(resMessage);
/*     */
/* 109 */       return resMessage;
/*     */     }
/*     */     catch (Exception e)
/*     */     {
View Full Code Here

/*     */     throws BindingException
/*     */   {
/* 118 */     log.debug("bindResponseMessage: " + opMetaData.getQName());
/*     */     try
/*     */     {
/* 122 */       SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
/* 123 */       if (msgContext == null) {
/* 124 */         throw new WSException("MessageContext not available");
/*     */       }
/*     */
/* 127 */       MessageFactoryImpl factory = new MessageFactoryImpl();
/* 128 */       factory.setEnvNamespace("http://schemas.xmlsoap.org/soap/envelope/");
/* 129 */       SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage();
/* 130 */       msgContext.setSOAPMessage(resMessage);
/*     */
/* 132 */       ParameterMetaData retParameter = opMetaData.getReturnParameter();
/* 133 */       QName xmlName = retParameter.getXmlName();
/* 134 */       SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody();
/* 135 */       SOAPContentElement bodyElement = new SOAPBodyElementDoc(xmlName);
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

   // 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();

         if (this.wsrmSequence != null)
         {
            if (RMConstant.PROTOCOL_OPERATION_QNAMES.contains(opName) == false)
            {
               if (this.wsrmSequence.getBackPort() != null)
               {
                  // rewrite ReplyTo to use client addressable back port
                  Map<String, Object> requestContext = getBindingProvider().getRequestContext();
                  AddressingProperties addressingProps = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
                  addressingProps.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(this.wsrmSequence.getBackPort()));
               }
               Map<String, Object> rmRequestContext = new HashMap<String, Object>();
               List<QName> outMsgs = new LinkedList<QName>();
               wsrmSequence.newMessageNumber();
               outMsgs.add(RMProvider.get().getConstants().getSequenceQName());
               outMsgs.add(RMProvider.get().getConstants().getAckRequestedQName());
               if (wsrmSequence.isAckRequested())
               {
                  // piggy backing
                  outMsgs.add(RMProvider.get().getConstants().getSequenceAcknowledgementQName());
               }
               rmRequestContext.put(RMConstant.PROTOCOL_MESSAGES, outMsgs);
               rmRequestContext.put(RMConstant.SEQUENCE_REFERENCE, wsrmSequence);
               reqContext.put(RMConstant.REQUEST_CONTEXT, rmRequestContext);
            }
         }

         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();

            if (this.wsrmSequence != null)
            {
               if (RMConstant.PROTOCOL_OPERATION_QNAMES.contains(opName) == false)
               {
                  Map<String, Object> wsrmResCtx = (Map<String, Object>)msgContext.get(RMConstant.RESPONSE_CONTEXT);
                  if (wsrmResCtx != null)
                  {
                     RMConstants wsrmConstants = RMProvider.get().getConstants();
                     Map<QName, RMSerializable> mapping = (Map<QName, RMSerializable>)wsrmResCtx.get(RMConstant.PROTOCOL_MESSAGES_MAPPING);
                     QName seq = wsrmConstants.getSequenceQName();
                     if (mapping.keySet().contains(seq))
                     {
                        RMHelper.handleSequenceHeader((RMSequence)mapping.get(seq), this.wsrmSequence);
                     }
                     QName seqAck = wsrmConstants.getSequenceAcknowledgementQName();
                     if (mapping.keySet().contains(seqAck))
                     {
                        RMHelper.handleSequenceAcknowledgementHeader((RMSequenceAcknowledgement)mapping.get(seqAck), this.wsrmSequence);
                     }
                     QName ackReq = wsrmConstants.getAckRequestedQName();
                     if (mapping.keySet().contains(ackReq))
                     {
                        RMHelper.handleAckRequestedHeader((RMAckRequested)mapping.get(ackReq), this.wsrmSequence);
                     }
                  }
               }
            }

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

         msgContext = new SOAPMessageContextJAXRPC();
         invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext);
      }
      else
      {
         msgContext = new SOAPMessageContextJAXWS();
         msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(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.