Package org.apache.cxf.ws.addressing.impl

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


        return dispatch;
    }
    private void addAddressing(BindingProvider p, boolean addSeq) {
        if (adHoc) {
            EndpointReferenceType to = new EndpointReferenceType();
            AddressingProperties addrProperties = new AddressingPropertiesImpl();
            AttributedURIType epr = new AttributedURIType();
            epr.setValue("urn:docs-oasis-open-org:ws-dd:ns:discovery:2009:01");
            to.setAddress(epr);
            addrProperties.setTo(to);
       
            p.getRequestContext()
                .put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProperties);
           
            if (addSeq) {
View Full Code Here


        EasyMock.expect(manager.createReliableEndpoint(e))
            .andReturn(rme).anyTimes();
        org.apache.cxf.transport.Destination destination = control
            .createMock(org.apache.cxf.transport.Destination.class);
        EasyMock.expect(exchange.getDestination()).andReturn(destination).anyTimes();
        AddressingPropertiesImpl maps = control.createMock(AddressingPropertiesImpl.class);
        EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(null);
        EasyMock.expect(message.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND))
            .andReturn(maps).anyTimes();
        EndpointReferenceType replyTo = RMUtils.createAnonymousReference();
        EasyMock.expect(maps.getReplyTo()).andReturn(replyTo).anyTimes();
        EasyMock.expect(exchange.getConduit(message)).andReturn(null).anyTimes();
        rme.initialise(null, replyTo, null);
        EasyMock.expectLastCall();

        control.replay();
View Full Code Here

                    rmps.setCloseSequence(close);
                }
                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());
                RMContextUtils.setProtocolVariation(message, ss.getProtocol());
View Full Code Here

                rmps.setCloseSequence(close);
            }
            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());
            RMContextUtils.setProtocolVariation(message, ss.getProtocol());
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

                rmps.setCloseSequence(close);
            }
            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());
            RMContextUtils.setProtocolVariation(message, ss.getProtocol());
View Full Code Here

            return new DOMSource(doc);           
        }
        private void updateOutputAction(String append) {
            AddressingProperties p = ContextUtils.retrieveMAPs(PhaseInterceptorChain.getCurrentMessage(),
                                                               false, false);
            AddressingProperties pout = new AddressingPropertiesImpl();
            AttributedURIType action = new AttributedURIType();
            action.setValue(p.getAction().getValue() + append);
            pout.exposeAs(p.getNamespaceURI());
            pout.setAction(action);
            ContextUtils.storeMAPs(pout, PhaseInterceptorChain.getCurrentMessage(), true);

        }
View Full Code Here

        EasyMock.expect(manager.createReliableEndpoint(e))
            .andReturn(rme).anyTimes();
        org.apache.cxf.transport.Destination destination = control
            .createMock(org.apache.cxf.transport.Destination.class);
        EasyMock.expect(exchange.getDestination()).andReturn(destination).anyTimes();
        AddressingPropertiesImpl maps = control.createMock(AddressingPropertiesImpl.class);
        EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(null);
        EasyMock.expect(message.get(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND))
            .andReturn(maps).anyTimes();
        EndpointReferenceType replyTo = RMUtils.createAnonymousReference();
        EasyMock.expect(maps.getReplyTo()).andReturn(replyTo).anyTimes();
        EasyMock.expect(exchange.getConduit(message)).andReturn(null).anyTimes();
        rme.initialise(null, replyTo, null);
        EasyMock.expectLastCall();

        control.replay();
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;
                QName invalidCardinalityQName = 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 (VersionTransformer.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)) {
                                invalidCardinalityQName = maps.getMessageID() != null
                                    ? Names.WSA_MESSAGEID_QNAME : null;
                                maps.setMessageID(decodeAsNative(
                                                       headerURI,
                                                       AttributedURIType.class,
                                                       headerElement,
                                                       unmarshaller));
                            } else if (Names.WSA_TO_NAME.equals(localName)) {
                                invalidCardinalityQName = maps.getTo() != null ? Names.WSA_TO_QNAME : null;
                                AttributedURIType addr = decodeAsNative(
                                                       headerURI,
                                                       AttributedURIType.class,
                                                       headerElement,
                                                       unmarshaller);
                                maps.setTo(EndpointReferenceUtils.getEndpointReference(addr));
                            } else if (Names.WSA_FROM_NAME.equals(localName)) {
                                invalidCardinalityQName = maps.getFrom() != null
                                    ? Names.WSA_FROM_QNAME : null;
                                maps.setFrom(decodeAsNative(
                                                       headerURI,
                                                       EndpointReferenceType.class,
                                                       headerElement,
                                                       unmarshaller));
                            } else if (Names.WSA_REPLYTO_NAME.equals(localName)) {
                                invalidCardinalityQName = maps.getReplyTo() != null
                                                                   ? Names.WSA_REPLYTO_QNAME : null;

                                maps.setReplyTo(decodeAsNative(
                                                       headerURI,
                                                       EndpointReferenceType.class,
                                                       headerElement,
                                                       unmarshaller));
                            } else if (Names.WSA_FAULTTO_NAME.equals(localName)) {
                                invalidCardinalityQName = maps.getFaultTo() != null
                                    ? Names.WSA_FAULTTO_QNAME : null;

                                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)) {
                                invalidCardinalityQName = maps.getAction() != null
                                    ? Names.WSA_ACTION_QNAME : null;
                                maps.setAction(decodeAsNative(
                                                       headerURI,
                                                       AttributedURIType.class,
                                                       headerElement,
                                                       unmarshaller));
                            }
                        } else if (null != headerElement.getAttribute(IS_REFERENCE_PARAM_ATTR_NAME)) {
                            if (null == referenceParameterHeaders) {
                                referenceParameterHeaders = new HashSet<Element>();
                            }
                            referenceParameterHeaders.add(headerElement);
                        } else if (headerURI.contains(Names.WSA_NAMESPACE_PATTERN)) {
                            LOG.log(Level.WARNING,
                                    "UNSUPPORTED_VERSION_MSG",
                                    headerURI);
                        }
                    }
                }
               
                if (maps != null && !MessageUtils.isRequestor(message) && maps.getReplyTo() == null) {
                    //per spec, if unspecified, replyTo is anon
                    AttributedURIType address =
                        ContextUtils.getAttributedURI(Names.WSA_ANONYMOUS_ADDRESS);
                    EndpointReferenceType replyTo =
                        ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType();
                    replyTo.setAddress(address);
                    maps.setReplyTo(replyTo);
                }

                if (null != referenceParameterHeaders && null != maps) {
                    decodeReferenceParameters(referenceParameterHeaders, maps, unmarshaller);
                }
View Full Code Here

        control.verify();
    }
   
    @Test
    public void testHandleApplicationMessage() throws NoSuchMethodException, SequenceFault, RMException {
        AddressingPropertiesImpl maps = createMAPs("greetMe", "localhost:9000/GreeterPort",
            org.apache.cxf.ws.addressing.Names.WSA_NONE_ADDRESS);
        Method[] mocked = new Method[] {
            AbstractRMInterceptor.class.getDeclaredMethod("getManager", new Class[]{}),
            RMOutInterceptor.class.getDeclaredMethod("isRuntimeFault", new Class[] {Message.class}),
            RMOutInterceptor.class.getDeclaredMethod("addAcknowledgements",
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.addressing.impl.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.