Package org.apache.cxf.ws.addressing

Examples of org.apache.cxf.ws.addressing.AddressingProperties


            Identifier sid = rmps.getSequence().getIdentifier();
            SourceSequence ss = s.getSequence(sid);
            RMMessage msg = new RMMessage();
            msg.setMessageNumber(rmps.getSequence().getMessageNumber());
            if (!MessageUtils.isRequestor(message)) {
                AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, true);
                if (null != maps && null != maps.getTo()) {
                    msg.setTo(maps.getTo().getValue());
                }
            }
            msg.setContent(bytes);
            store.persistOutgoing(ss, msg);
        }
View Full Code Here


            // to http://schemas.xmlsoap.org/ws/2004/a08/addressing/fault
            // but: need to defer propagation of received MAPS to outbound chain first          
            return;
        }
      
        AddressingProperties maps =
            RMContextUtils.retrieveMAPs(message, false, true);
        if (null == maps) {
            LogUtils.log(LOG, Level.WARNING, "MAPS_RETRIEVAL_FAILURE_MSG");
            return;
        }
       
        RMContextUtils.ensureExposedVersion(maps);
       
        Source source = getManager().getSource(message);
        Destination destination = getManager().getDestination(message);

        String action = null;
        if (maps != null && null != maps.getAction()) {
            action = maps.getAction().getValue();
        }
       
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Action: " + action);
        }

        boolean isApplicationMessage = !RMContextUtils.isRMProtocolMessage(action);
        boolean isPartialResponse = MessageUtils.isPartialResponse(message);
        boolean isLastMessage = RMConstants.getLastMessageAction().equals(action);
       
        if (isApplicationMessage && !isPartialResponse) {
            RetransmissionInterceptor ri = new RetransmissionInterceptor();
            ri.setManager(getManager());
            // TODO:
            // On the server side: If a fault occurs after this interceptor we will switch
            // interceptor chains (if this is not already a fault message) and therefore need to
            // make sure the retransmission interceptor is added to the fault chain
            //
            message.getInterceptorChain().add(ri);
            LOG.fine("Added RetransmissionInterceptor to chain.");
           
            getManager().getRetransmissionQueue().start();
        }
       
        RMProperties rmpsOut = (RMProperties)RMContextUtils.retrieveRMProperties(message, true);
        if (null == rmpsOut) {
            rmpsOut = new RMProperties();
            RMContextUtils.storeRMProperties(message, rmpsOut, true);
        }
       
        RMProperties rmpsIn = null;
        Identifier inSeqId = null;
        BigInteger inMessageNumber = null;
       
        if (isApplicationMessage) {
            rmpsIn = (RMProperties)RMContextUtils.retrieveRMProperties(message, false);
            if (null != rmpsIn && null != rmpsIn.getSequence()) {
                inSeqId = rmpsIn.getSequence().getIdentifier();
                inMessageNumber = rmpsIn.getSequence().getMessageNumber();
            }
            ContextUtils.storeDeferUncorrelatedMessageAbort(message);
        }
       
        if ((isApplicationMessage || isLastMessage)
            && !isPartialResponse) {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("inbound sequence: " + (null == inSeqId ? "null" : inSeqId.getValue()));
            }
           
            // get the current sequence, requesting the creation of a new one if necessary
           
            synchronized (source) {
                SourceSequence seq = null;
                if (isLastMessage) {
                    Map<?, ?> invocationContext = (Map)message.get(Message.INVOCATION_CONTEXT);
                    seq = (SourceSequence)invocationContext.get(SourceSequence.class.getName());
                } else {
                    seq = getManager().getSequence(inSeqId, message, maps);
                }
                assert null != seq;

                // increase message number and store a sequence type object in
                // context

                seq.nextMessageNumber(inSeqId, inMessageNumber, isLastMessage);
               
                rmpsOut.setSequence(seq);

                // if this was the last message in the sequence, reset the
                // current sequence so that a new one will be created next
                // time the handler is invoked

                if (seq.isLastMessage()) {
                    source.setCurrent(null);
                }
            }
        } else {
            if (!MessageUtils.isRequestor(message)
                && RMConstants.getCreateSequenceAction().equals(action)) {
                maps.getAction().setValue(RMConstants.getCreateSequenceResponseAction());
            }
        }
       
        // add Acknowledgements (to application messages or explicitly
        // created Acknowledgement messages only)

        if (isApplicationMessage
            || RMConstants.getSequenceAcknowledgmentAction().equals(action)) {
            AttributedURI to = VersionTransformer.convert(maps.getTo());
            assert null != to;
            addAcknowledgements(destination, rmpsOut, inSeqId, to);
            if (isPartialResponse && rmpsOut.getAcks() != null && rmpsOut.getAcks().size() > 0) {
                AttributedURIType actionURI = new AttributedURIType();
                actionURI.setValue(RMConstants.getSequenceAcknowledgmentAction());
                maps.setAction(actionURI);
            }
        }
       
        if (RMConstants.getSequenceAckAction().equals(action)
            || RMConstants.getTerminateSequenceAction().equals(action)) {
            maps.setReplyTo(RMUtils.createNoneReference());
        }
       
        assertReliability(message);
    }
View Full Code Here

        EasyMock.expect(exchange.getOutFaultMessage()).andReturn(null).anyTimes();
        Conduit conduit = control.createMock(Conduit.class);
        EasyMock.expect(exchange.getConduit(message)).andReturn(conduit).anyTimes();
        EasyMock.expect(conduit.getBackChannel()).andReturn(null).anyTimes();
        Identifier inSid = control.createMock(Identifier.class);       
        AddressingProperties maps = control.createMock(AddressingProperties.class);
        Source source = control.createMock(Source.class);
        EasyMock.expect(manager.getSource(message)).andReturn(source);
        EasyMock.expect(source.getCurrent(inSid)).andReturn(null);
        AttributedURIType uri = control.createMock(AttributedURIType.class);
        EasyMock.expect(maps.getTo()).andReturn(uri);
        EasyMock.expect(uri.getValue()).andReturn("http://localhost:9001/TestPort");
        EndpointReferenceType epr = RMUtils.createNoneReference();
        EasyMock.expect(maps.getReplyTo()).andReturn(epr);
        RMEndpoint rme = control.createMock(RMEndpoint.class);
        EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).times(2);
        Proxy proxy = control.createMock(Proxy.class);
        EasyMock.expect(rme.getProxy()).andReturn(proxy);
        CreateSequenceResponseType createResponse = control.createMock(CreateSequenceResponseType.class);
View Full Code Here

                RMProperties rmps = new RMProperties();
                rmps.setSequence(st);
                RMContextUtils.storeRMProperties(message, rmps, true);               
                if (null == conduit) {
                    String to = m.getTo();
                    AddressingProperties maps = new AddressingPropertiesImpl();
                    maps.setTo(RMUtils.createReference(to));
                    RMContextUtils.storeMAPs(maps, message, true, false);
                }
                                   
                message.setContent(byte[].class, m.getContent());
                         
View Full Code Here

     * @return the id from the reference parameters of the  ws-a-to address or null if not found
     * @see org.apache.cxf.transport.MultiplexDestination#getId(java.util.Map)
     */
    public String getId(Map contextMap) {
        String markedParam = null;
        AddressingProperties maps = (AddressingProperties)contextMap
            .get(SERVER_ADDRESSING_PROPERTIES_INBOUND);
        if (null != maps) {
            EndpointReferenceType toEpr = maps.getToEndpointReference();
            if (null != toEpr) {
                markedParam = extractStringElementFromAny(MULTIPLEX_ID_QNAME, toEpr);
            }
        }
        return markedParam;
View Full Code Here

     *
     * @param message the messsage message
     */
    public void handleFault(SoapMessage message) {
        if (!message.getExchange().isOneWay()) {
            AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, true, false);
            if (ContextUtils.isRequestor(message)
                && maps != null) {
                //fault occurred trying to send the message, remove it
                uncorrelatedExchanges.remove(maps.getMessageID().getValue());
            } else if (!ContextUtils.isRequestor(message)
                && maps == null
                && !message.containsKey(MAPAggregator.class.getName())) {
                //fault occurred while processing the incoming message, but possibly
                //before the MAPAggregator was called.   We need to see if we can
View Full Code Here

    private void mediate(SoapMessage message) {
        if (!MessageUtils.getContextualBoolean(message, MAPAggregator.ADDRESSING_DISABLED, false)) {
            if (ContextUtils.isOutbound(message)) {
                encode(message, ContextUtils.retrieveMAPs(message, false, true));
            } else if (null == ContextUtils.retrieveMAPs(message, false, false, false)) {           
                AddressingProperties maps = decode(message);
                ContextUtils.storeMAPs(maps, message, false);
                markPartialResponse(message, maps);
                restoreExchange(message, maps);
               
                if (maps != null
                    && !MessageUtils.isRequestor(message)
                    && message.getExchange().getBindingOperationInfo() == null
                    && !MessageUtils.isOutbound(message)
                    && maps.getAction() != null) {
                    //try and use the Action from the maps to find the operation
                    String action = maps.getAction().getValue();
                    if (action != null) {
                        SoapActionInInterceptor.getAndSetOperation(message, action);
                    }
                }
            }
View Full Code Here

                } else if (!MessageUtils.getContextualBoolean(message,
                                          "org.apache.cxf.ws.addressing.MAPAggregator.addressingDisabled",
                                          false)) {
                    //see if it can directly be correlated with the out message:
                    Message outmsg = message.getExchange().getOutMessage();
                    AddressingProperties outp = outmsg != null
                        ? ContextUtils.retrieveMAPs(outmsg, false, true, false) : null;
                    if (outp == null
                        || !outp.getMessageID().getValue().equals(maps.getRelatesTo().getValue())) {
                        LOG.log(Level.WARNING, "CORRELATION_FAILURE_MSG");
                        message.getInterceptorChain().abort();
                    }
                }
            }
View Full Code Here

        maps.setAction(ContextUtils.getAttributedURI(""));
        setUpMessageProperty(message,
                             CLIENT_ADDRESSING_PROPERTIES,
                             maps);
        aggregator.mediate(message, false);
        AddressingProperties props =
            (AddressingProperties)message.get(JAXWSAConstants.ADDRESSING_PROPERTIES_OUTBOUND);
        assertSame(replyTo, props.getReplyTo());
    }
View Full Code Here

        addBefore(MessageSenderInterceptor.class.getName());
    }

   
    public void handleMessage(Message message) throws Fault {
        AddressingProperties maps =
            RMContextUtils.retrieveMAPs(message, false, true);
        RMContextUtils.ensureExposedVersion(maps);
        String action = null;
        if (maps != null && null != maps.getAction()) {
            action = maps.getAction().getValue();
        }
        if (RMContextUtils.isRMProtocolMessage(action)) {
            return;
        }
        appMessageCount++;
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.addressing.AddressingProperties

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.