Package javax.xml.ws.handler

Examples of javax.xml.ws.handler.MessageContext


        }
        NormalizedMessage out = exchange.createMessage();
        try {
      Tie tie = new Tie();
      WSConnection con = new WSConnectionDelegate(in, out);
            MessageContext msgCtxt = new MessageContextImpl();
            WebServiceContext wsContext = rtEndpointInfo.getWebServiceContext();
            wsContext.setMessageContext(msgCtxt);
      tie.handle(con, rtEndpointInfo);
            if (isInAndOut(exchange)) {
                answer(exchange, out);
View Full Code Here


            message.getInterceptorChain().add(ending);
        }
    }
   
    private void handleMessageInternal(SoapMessage message) {
        MessageContext context = createProtocolMessageContext(message);
        HandlerChainInvoker invoker = getInvoker(message);
        invoker.setProtocolMessageContext(context);       

        try {
            if (!invoker.invokeProtocolHandlersHandleFault(isRequestor(message), context)) {
View Full Code Here

        }
    }

    private void addReplyOutOfBandHeader() {
        if (context != null) {
            MessageContext ctx = context.getMessageContext();
            if (ctx != null) {
                try {
                    OutofBandHeader ob = new OutofBandHeader();
                    ob.setName("testOobReturnHeaderName");
                    ob.setValue("testOobReturnHeaderValue");
                    ob.setHdrAttribute("testReturnHdrAttribute");
                    JAXBElement<OutofBandHeader> job = new JAXBElement<OutofBandHeader>(
                            new QName(Constants.TEST_HDR_NS, Constants.TEST_HDR_RESPONSE_ELEM),
                            OutofBandHeader.class, null, ob);
                    Header hdr = new Header(
                            new QName(Constants.TEST_HDR_NS, Constants.TEST_HDR_RESPONSE_ELEM),
                            job,
                            new JAXBDataBinding(ob.getClass()));
                    List<Header> hdrList = CastUtils.cast((List<?>) ctx.get(Header.HEADER_LIST));
                    hdrList.add(hdr);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
View Full Code Here

            }
        }
    }
   
    private boolean validateOutOfBandHander() {
        MessageContext ctx = context == null ? null : context.getMessageContext();
        if (!relayHeaders) {
            if (ctx != null
                && !ctx.containsKey(Header.HEADER_LIST)
                || (ctx.containsKey(Header.HEADER_LIST)
                    && ((List)ctx.get(Header.HEADER_LIST)).size() == 0)) {
                return true;
            }
            return false;
        }
       
        boolean success = false;
        if (ctx != null && ctx.containsKey(Header.HEADER_LIST)) {
            List oobHdr = (List) ctx.get(Header.HEADER_LIST);
            Iterator iter = oobHdr.iterator();
            while (iter.hasNext()) {
                Object hdr = iter.next();
                if (hdr instanceof Header && ((Header) hdr).getObject() instanceof Node) {
                    Header hdr1 = (Header) hdr;
View Full Code Here

        }
    }

    public static void storeCXfResponseContext(Message response, Map<String, Object> context) {
        if (context != null) {
            MessageContext messageContext = new WrappedMessageContext(context, null, Scope.HANDLER);
            response.put(Client.RESPONSE_CONTEXT, messageContext);
            //put the protocol headers into the message headers
            Map<String, List<String>> protocolHeaders =
                CastUtils.cast((Map)messageContext.get(Message.PROTOCOL_HEADERS));
            response.put(Message.PROTOCOL_HEADERS, protocolHeaders);           
            Object value = context.get(Message.RESPONSE_CODE);           
            if (value != null) {
                response.put(Message.RESPONSE_CODE, value);
            }
View Full Code Here

        }
    }

    private boolean handleMessageInternal(SoapMessage message) {
       
        MessageContext context = createProtocolMessageContext(message);
        if (context == null) {
            return true;
        }
               
        HandlerChainInvoker invoker = getInvoker(message);
View Full Code Here

  
        // Find processed token corresponding to the URI
        if (referenceURI.charAt(0) == '#') {
            referenceURI = referenceURI.substring(1);
        }
        MessageContext messageContext = wsContext.getMessageContext();
        final List<WSHandlerResult> handlerResults =
            CastUtils.cast((List<?>) messageContext.get(WSHandlerConstants.RECV_RESULTS));
       
        if (handlerResults != null && handlerResults.size() > 0) {
            WSHandlerResult handlerResult = handlerResults.get(0);
            List<WSSecurityEngineResult> engineResults = handlerResult.getResults();
           
View Full Code Here

       
        public boolean checkProofOfPossession(
            TokenRenewerParameters tokenParameters,
            SAMLKeyInfo subjectKeyInfo
        ) {
            MessageContext messageContext = tokenParameters.getWebServiceContext().getMessageContext();
            final List<WSHandlerResult> handlerResults =
                CastUtils.cast((List<?>) messageContext.get(WSHandlerConstants.RECV_RESULTS));

            List<WSSecurityEngineResult> signedResults = new ArrayList<WSSecurityEngineResult>();
            if (handlerResults != null && handlerResults.size() > 0) {
                WSHandlerResult handlerResult = handlerResults.get(0);
                List<WSSecurityEngineResult> results = handlerResult.getResults();
               
                WSSecurityUtil.fetchAllActionResults(results, WSConstants.SIGN, signedResults);
                WSSecurityUtil.fetchAllActionResults(results, WSConstants.UT_SIGN, signedResults);
            }
           
            TLSSessionInfo tlsInfo = (TLSSessionInfo)messageContext.get(TLSSessionInfo.class.getName());
            Certificate[] tlsCerts = null;
            if (tlsInfo != null) {
                tlsCerts = tlsInfo.getPeerCertificates();
            }
           
View Full Code Here

        return response;
    }
   
    private boolean matchKey(TokenCancellerParameters tokenParameters, byte[] secretKey) {
        boolean result = false;
        MessageContext messageContext = tokenParameters.getWebServiceContext().getMessageContext();
        final List<WSHandlerResult> handlerResults =
            CastUtils.cast((List<?>) messageContext.get(WSHandlerConstants.RECV_RESULTS));

        if (handlerResults != null && handlerResults.size() > 0) {
            WSHandlerResult handlerResult = handlerResults.get(0);
            List<WSSecurityEngineResult> engineResults = handlerResult.getResults();
View Full Code Here

                //ignore
            }
            me = me.substring("PauseForTwoSecs".length()).trim();
        }
       
        MessageContext mc = wsContext.getMessageContext();
        JMSMessageHeadersType headers =
            (JMSMessageHeadersType) mc.get(JMSConstants.JMS_SERVER_REQUEST_HEADERS);
        System.out.println("get the message headers JMSCorrelationID: " + headers.getJMSCorrelationID());
        System.out.println("Reached here :" + me);
       
        // set reply header custom property
        JMSPropertyType testProperty = new JMSPropertyType();
        testProperty.setName("Test_Prop");
        testProperty.setValue("some return value "  + me);
       
        System.out.println("found property in request headers at index: "
                           + headers.getProperty().indexOf(testProperty));
       
        JMSMessageHeadersType responseHeaders =
            (JMSMessageHeadersType) mc.get(JMSConstants.JMS_SERVER_RESPONSE_HEADERS);
        responseHeaders.getProperty().add(testProperty);
       
        return "Hello " + me;
    }
View Full Code Here

TOP

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

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.