Package org.apache.cxf.ws.addressing

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


            boolean isServer = RMContextUtils.isServerSide(message);
            EndpointReferenceType acksTo = null;
            RelatesToType relatesTo = null;
            if (isServer) {

                AddressingPropertiesImpl inMaps = RMContextUtils.retrieveMAPs(message, false, false);
                inMaps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
                acksTo = RMUtils.createReference2004(inMaps.getTo().getValue());
                to = inMaps.getReplyTo();
                source.getReliableEndpoint().getServant().setUnattachedIdentifier(inSeqId);
                relatesTo = (new org.apache.cxf.ws.addressing.ObjectFactory()).createRelatesToType();
                Destination destination = getDestination(message);
                DestinationSequence inSeq = inSeqId == null ? null : destination.getSequence(inSeqId);
                relatesTo.setValue(inSeq != null ? inSeq.getCorrelationID() : null);
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.put(RMMessageConstants.SAVED_CONTENT, m.getCachedOutputStream());
                         
View Full Code Here

       
        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
       
        // message addressing properties may be null, e.g. in case of a runtime fault
        // on the server side
        final AddressingPropertiesImpl maps = RMContextUtils.retrieveMAPs(message, false, false);
        if (null == maps) {
            return;
        }

        String action = null;
        if (null != maps.getAction()) {
            action = maps.getAction().getValue();
        }

        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Action: " + action);
        }
View Full Code Here

    public void testExplicitMAPs() throws Exception {
        try {
            String msgId = "urn:uuid:12345-" + Math.random();
            Map<String, Object> requestContext =
                ((BindingProvider)greeter).getRequestContext();
            AddressingProperties maps = new AddressingPropertiesImpl();
            AttributedURIType id =
                ContextUtils.getAttributedURI(msgId);
            maps.setMessageID(id);
            requestContext.put(CLIENT_ADDRESSING_PROPERTIES, maps);
            String greeting = greeter.greetMe("explicit1");
            assertEquals("unexpected response received from service",
                         "Hello explicit1",
                         greeting);
            checkVerification();

            // the previous addition to the request context impacts
            // on all subsequent invocations on this proxy => a duplicate
            // message ID fault is expected
            try {
                greeter.greetMe("explicit2");
                fail("expected ProtocolException on duplicate message ID");
            } catch (ProtocolException pe) {
                assertEquals("expected duplicate message ID failure",
                           "Duplicate Message ID " + msgId, pe.getMessage());
                checkVerification();
            }

            // clearing the message ID ensure a duplicate is not sent
            maps.setMessageID(null);
            //maps.setRelatesTo(ContextUtils.getRelatesTo(id.getValue()));
            greeting = greeter.greetMe("explicit3");
            assertEquals("unexpected response received from service",
                         "Hello explicit3",
                         greeting);
View Full Code Here

        boolean isOutbound = ContextUtils.isOutbound(message);
        String mapProperty =
            (String)mapProperties.get(isOutbound
                                      ? MAPTest.OUTBOUND_KEY
                                      : MAPTest.INBOUND_KEY);
        AddressingPropertiesImpl maps =
            (AddressingPropertiesImpl)message.get(mapProperty);
        if (maps == null) {
            return;
        }
        if (ContextUtils.isRequestor(message)) {
            if (isOutbound) {
                String exposeAs = getExpectedExposeAs(false);
                if (exposeAs != null) {
                    maps.exposeAs(exposeAs);
                }
            } else {
                String exposeAs = getExpectedExposeAs(true);
                String expected = exposeAs != null
                                  ? exposeAs
                                  : Names.WSA_NAMESPACE_NAME;
                if (maps.getNamespaceURI() != expected) {
                    verificationCache.put("Incoming version mismatch"
                                          + " expected: " + expected
                                          + " got: " + maps.getNamespaceURI());
                }
                exposeAs = null;
            }
        }
        verificationCache.put(MAPTest.verifyMAPs(maps, this));
View Full Code Here

        AddNumbersPortType port = getPort();
        ((BindingProvider)port).getRequestContext()
            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                 "http://localhost:" + PORT + "/jaxws/addAnon");
       
        AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
        EndpointReferenceType ref = new EndpointReferenceType();
        AttributedURIType add = new AttributedURIType();
        add.setValue("http://localhost:" + INVALID_PORT + "/not/a/real/url");
        ref.setAddress(add);
        maps.setReplyTo(ref);
        maps.setFaultTo(ref);

        ((BindingProvider)port).getRequestContext()
            .put("javax.xml.ws.addressing.context", maps);

        try {
View Full Code Here

        public Object invoke(Exchange exchange, Object o) {
            AddressingProperties inProps = (AddressingProperties)exchange.getInMessage()
                .getContextualProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
            if (inProps != null) {
                AddressingProperties props = new AddressingPropertiesImpl(inProps.getNamespaceURI());
                AttributedURIType action = new AttributedURIType();
                action.setValue(inProps.getAction().getValue().replace("/RST/", "/RSTR/"));
                props.setAction(action);
                exchange.getOutMessage().put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
                                             props);
            }
           
            MessageContentsList lst = (MessageContentsList)o;
View Full Code Here

     * @exception SOAPFaultException if decoded MAPs are invalid
     */
    public AddressingProperties unmarshalMAPs(SoapMessage message) {
        // REVISIT generate MessageAddressingHeaderRequired fault if an
        // expected header is missing
        AddressingPropertiesImpl maps = null;
        try {
            List<Header> header = message.getHeaders();
            if (header != null) {
                LOG.log(Level.FINE, "Inbound WS-Addressing headers");
                Unmarshaller unmarshaller = null;
                Set<Element> referenceParameterHeaders = null;

                Iterator<Header> iter = header.iterator();
                while (iter.hasNext()) {
                    Header hdr = iter.next();
                    if (hdr.getObject() instanceof Element) {
                        Element headerElement = (Element)hdr.getObject();
                        String headerURI = headerElement.getNamespaceURI();
                        // Need to check the uri before getting unmarshaller else
                        // would get wrong unmarshaller and fail to process required
                        // headers.
                        if (transformer.isSupported(headerURI)) {
                            if (unmarshaller == null) {
                                JAXBContext jaxbContext =
                                    VersionTransformer.getExposedJAXBContext(headerURI);
                                unmarshaller =
                                    jaxbContext.createUnmarshaller();
                            }
                            if (maps == null) {
                                maps = new AddressingPropertiesImpl();
                                maps.exposeAs(headerURI);
                            }
                            String localName = headerElement.getLocalName();
                            if (Names.WSA_MESSAGEID_NAME.equals(localName)) {
                                maps.setMessageID(decodeAsNative(
                                                       headerURI,
                                                       AttributedURIType.class,
                                                       headerElement,
                                                       unmarshaller));
                            } else if (Names.WSA_TO_NAME.equals(localName)) {
                                AttributedURIType addr = decodeAsNative(
                                                       headerURI,
                                                       AttributedURIType.class,
                                                       headerElement,
                                                       unmarshaller);
                                maps.setTo(EndpointReferenceUtils.getEndpointReference(addr));
                            } else if (Names.WSA_FROM_NAME.equals(localName)) {
                                maps.setFrom(decodeAsNative(
                                                       headerURI,
                                                       EndpointReferenceType.class,
                                                       headerElement,
                                                       unmarshaller));
                            } else if (Names.WSA_REPLYTO_NAME.equals(localName)) {
                                maps.setReplyTo(decodeAsNative(
                                                       headerURI,
                                                       EndpointReferenceType.class,
                                                       headerElement,
                                                       unmarshaller));
                            } else if (Names.WSA_FAULTTO_NAME.equals(localName)) {
                                maps.setFaultTo(decodeAsNative(
                                                       headerURI,
                                                       EndpointReferenceType.class,
                                                       headerElement,
                                                       unmarshaller));
                            } else if (Names.WSA_RELATESTO_NAME.equals(localName)) {
                                maps.setRelatesTo(decodeAsNative(
                                                       headerURI,
                                                       RelatesToType.class,
                                                       headerElement,
                                                       unmarshaller));
                            } else if (Names.WSA_ACTION_NAME.equals(localName)) {
                                maps.setAction(decodeAsNative(
                                                       headerURI,
                                                       AttributedURIType.class,
                                                       headerElement,
                                                       unmarshaller));
                            }
View Full Code Here

        if (message.getExchange().isOneWay()
            && !ContextUtils.isRequestor(message)) {
           
            Exchange exchange = message.getExchange();
            Message inMessage = exchange.getInMessage();
            final AddressingPropertiesImpl maps =
                ContextUtils.retrieveMAPs(inMessage, false, false, true);
           
            if (maps != null && !ContextUtils.isGenericAddress(maps.getFaultTo())) {
                exchange.setOneWay(false);
                exchange.setOutMessage(message);
               
                Destination destination = createDecoupledDestination(
                                               exchange, maps.getFaultTo());
                exchange.setDestination(destination);
            }
           
        }
    }
View Full Code Here

            }   
        };
       
        SoapMessage message = new SoapMessage(new MessageImpl());
       
        AddressingProperties maps = new AddressingPropertiesImpl();
       
        EndpointReferenceType faultTo = new EndpointReferenceType();
        faultTo.setAddress(new AttributedURIType());
        faultTo.getAddress().setValue("http://bar");
        maps.setFaultTo(faultTo);
        message.put(ContextUtils.getMAPProperty(false, false, false),
                    maps);
       
        Exchange exchange = new ExchangeImpl();
        message.setExchange(exchange);
View Full Code Here

TOP

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

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.