Package org.jboss.ws.core

Examples of org.jboss.ws.core.CommonMessageContext


      QName xmlType = container.getXmlType();
      Class javaType = container.getJavaType();

      log.debug("getXMLFragment from Object [xmlType=" + xmlType + ",javaType=" + javaType + "]");

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if (msgContext == null)
         throw new WSException("MessageContext not available");

      SerializationContext serContext = msgContext.getSerializationContext();
      serContext.setJavaType(javaType);
      ParameterMetaData pmd = container.getParamMetaData();
      OperationMetaData opMetaData = pmd.getOperationMetaData();
      List<Class> registeredTypes = opMetaData.getEndpointMetaData().getRegisteredTypes();
      serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES, registeredTypes.toArray(new Class[0]));
View Full Code Here


   }
  
   private String getSOAPContentType() throws SOAPException
   {
      //Check binding type in the endpoint metadata
      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if (msgContext != null && Constants.SOAP12HTTP_BINDING.equalsIgnoreCase(msgContext.getEndpointMetaData().getBindingId()))
      {
         return SOAPConstants.SOAP_1_2_CONTENT_TYPE;
      }
      //Check the message envelope
      SOAPEnvelope env = soapPart != null ? soapPart.getEnvelope() : null;
View Full Code Here

          */

         saveRequired = false;
      }

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if(msgContext!=null) msgContext.setModified(true);
   }
View Full Code Here

      QName xmlType = container.getXmlType();
      Class javaType = container.getJavaType();

      log.debug("getObjectValue [xmlType=" + xmlType + ",javaType=" + javaType + "]");

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if (msgContext == null)
         throw new WSException("MessageContext not available");

      SerializationContext serContext = msgContext.getSerializationContext();
      ParameterMetaData pmd = container.getParamMetaData();
      OperationMetaData opMetaData = pmd.getOperationMetaData();
      serContext.setProperty(ParameterMetaData.class.getName(), pmd);
      serContext.setJavaType(javaType);
      List<Class> registeredTypes = opMetaData.getEndpointMetaData().getRegisteredTypes();
View Full Code Here

      stack.push(msgContext);
   }

   public static CommonMessageContext peekMessageContext()
   {
      CommonMessageContext msgContext = null;
      Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
      if (stack != null && stack.isEmpty() == false)
      {
         msgContext = stack.peek();
      }
View Full Code Here

      return popMessageContext(true);
   }
  
   public static CommonMessageContext popMessageContext(boolean clearDOMIfEmpty)
   {
      CommonMessageContext msgContext = null;
      Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
      if (stack != null && stack.isEmpty() == false)
      {
         msgContext = stack.pop();
         if (stack.isEmpty() == true && clearDOMIfEmpty == true)
View Full Code Here

   protected abstract Marshaller getMarshaller();

   private Map<String, Object> createRemotingMetaData(MessageAbstraction reqMessage, Map callProps)
   {
      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();

      Map<String, Object> metadata = new HashMap<String, Object>();

      // We need to unmarshall faults (HTTP 500)
      // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
      metadata.put("NoThrowOnError", "true");

      if (reqMessage != null)
      {
         populateHeaders(reqMessage, metadata);

         // Enable chunked encoding. This is the default size.
         clientConfig.put("chunkedLength", "1024");

         // May be overridden through endpoint config
         if (msgContext != null)
         {
            CommonConfig config = msgContext.getConfig();

            // chunksize settings
            String chunkSizeValue = config.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE);
            int chunkSize = chunkSizeValue != null ? Integer.valueOf(chunkSizeValue) : -1;
            if (chunkSize > 0)
View Full Code Here

    * This may differ from the wire format when jaxrpc handlers are in place.
    */
   public static boolean isXOPMessage()
   {
      boolean isXOP = false;
      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if (msgContext != null)
      {
         SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
         isXOP = (soapMessage != null && soapMessage.isXOPMessage());
      }
      return isXOP;
   }
View Full Code Here

   }

   public static boolean isSWARefMessage()
   {
      boolean isSWARef = false;
      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if (msgContext != null)
      {
         SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
         isSWARef = (soapMessage != null && soapMessage.isSWARefMessage());
      }
      return isSWARef;
   }
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);
      msgContext.setEndpointMetaData(epMetaData);
      msgContext.setSOAPMessage(reqMsg);
      msgContext.putAll(reqContext);

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

TOP

Related Classes of org.jboss.ws.core.CommonMessageContext

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.