Examples of AddressingPropertiesImpl


Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

    public void testExplicitMAPs() throws Exception {
        try {
            Map<String, Object> requestContext =
                ((BindingProvider)greeter).getRequestContext();
            AddressingProperties maps = new AddressingPropertiesImpl();
            AttributedURIType id =
                ContextUtils.getAttributedURI("urn:uuid:12345");
            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) {
                assertTrue("expected duplicate message ID failure",
                           "Duplicate Message ID urn:uuid:12345".equals(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);
        } catch (UndeclaredThrowableException ex) {
View Full Code Here

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

        boolean isOutbound = ContextUtils.isOutbound(context);
        String mapProperty =
            (String)mapProperties.get(isOutbound
                                      ? MAPTest.OUTBOUND_KEY
                                      : MAPTest.INBOUND_KEY);
        AddressingPropertiesImpl maps =
            (AddressingPropertiesImpl)context.get(mapProperty);
        if (ContextUtils.isRequestor(context)) {
            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

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

     * @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 {
            SOAPEnvelope env = message.getSOAPPart().getEnvelope();
            SOAPHeader header = env.getHeader();
            if (header != null) {
                Unmarshaller unmarshaller = null;
                Iterator headerElements = header.examineAllHeaderElements();
                while (headerElements.hasNext()) {
                    SOAPHeaderElement headerElement =
                        (SOAPHeaderElement)headerElements.next();
                    Name headerName = headerElement.getElementName();
                    String headerURI = headerName.getURI();
                    if (unmarshaller == null) {
                        JAXBContext jaxbContext =
                            VersionTransformer.getExposedJAXBContext(headerURI);
                        unmarshaller =
                            jaxbContext.createUnmarshaller();
                    }
                    if (transformer.isSupported(headerURI)) {
                        if (maps == null) {
                            maps = new AddressingPropertiesImpl();
                            maps.exposeAs(headerURI);
                        }
                        String localName = headerName.getLocalName();
                        LOG.log(Level.INFO, "decoding WSA header {0}", localName);
                        if (Names.WSA_MESSAGEID_NAME.equals(localName)) {
                            maps.setMessageID(transformer.decodeAsNative(
                                                      headerURI,
                                                      AttributedURIType.class,
                                                      headerElement,
                                                      unmarshaller));
                        } else if (Names.WSA_TO_NAME.equals(localName)) {
                            maps.setTo(transformer.decodeAsNative(
                                                      headerURI,
                                                      AttributedURIType.class,
                                                      headerElement,
                                                      unmarshaller));
                        } else if (Names.WSA_REPLYTO_NAME.equals(localName)) {
                            maps.setReplyTo(transformer.decodeAsNative(
                                                       headerURI,
                                                       EndpointReferenceType.class,
                                                       headerElement,
                                                       unmarshaller));
                        } else if (Names.WSA_FAULTTO_NAME.equals(localName)) {
                            maps.setFaultTo(transformer.decodeAsNative(
                                                                       headerURI,
                                                                       EndpointReferenceType.class,
                                                                       headerElement,
                                                                       unmarshaller));
                        } else if (Names.WSA_RELATESTO_NAME.equals(localName)) {
                            maps.setRelatesTo(transformer.decodeAsNative(
                                                       headerURI,
                                                       RelatesToType.class,
                                                       headerElement,
                                                       unmarshaller));
                        } else if (Names.WSA_ACTION_NAME.equals(localName)) {
                            maps.setAction(transformer.decodeAsNative(
                                                      headerURI,
                                                      AttributedURIType.class,
                                                      headerElement,
                                                      unmarshaller));
                        }
View Full Code Here

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

    public void testExplicitMAPs() throws Exception {
        try {
            Map<String, Object> requestContext =
                ((BindingProvider)greeter).getRequestContext();
            AddressingProperties maps = new AddressingPropertiesImpl();
            AttributedURIType id =
                ContextUtils.getAttributedURI("urn:uuid:12345");
            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) {
                assertTrue("expected duplicate message ID failure",
                           "Duplicate Message ID urn:uuid:12345".equals(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);
        } catch (UndeclaredThrowableException ex) {
View Full Code Here

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

        ContextUtils.storeUsingAddressing(true, getObjectMessageContext());

        getObjectMessageContext().setRequestorRole(true);
       
        AddressingProperties maps = new AddressingPropertiesImpl();
        AttributedURIType actionURI = ContextUtils.WSA_OBJECT_FACTORY.createAttributedURIType();
        actionURI.setValue(RMUtils.getRMConstants().getCreateSequenceAction());
        maps.setAction(actionURI);
        maps.setRelatesTo(relatesTo);
        ContextUtils.storeMAPs(maps, getObjectMessageContext(), true, true, true, true);
           
        setMessageParameters(source, acksTo);
       
        // this request is sent as the initial request in a pair of
View Full Code Here

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

    }

    protected void handleOutbound(LogicalMessageContext context) throws SequenceFault {
        LOG.entering(getClass().getName(), "handleOutbound");
        AddressingPropertiesImpl maps =
            ContextUtils.retrieveMAPs(context, false, true);
     
        // ensure the appropriate version of WS-Addressing is used      
        maps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);

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

        // nothing to do if this is a CreateSequence, TerminateSequence or
        // SequenceInfo request

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

        boolean isApplicationMessage = true;
       
        if (RMUtils.getRMConstants().getCreateSequenceAction().equals(action)
            || RMUtils.getRMConstants().getCreateSequenceResponseAction().equals(action)
            || RMUtils.getRMConstants().getTerminateSequenceAction().equals(action)
            || RMUtils.getRMConstants().getLastMessageAction().equals(action)
            || RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)
            || RMUtils.getRMConstants().getSequenceInfoAction().equals(action)) {
            isApplicationMessage = false;
        }
       
        RMPropertiesImpl rmpsOut = (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(context, true);
        if (null == rmpsOut) {
            rmpsOut = new RMPropertiesImpl();
            RMContextUtils.storeRMProperties(context, rmpsOut, true);
        }
       
        RMPropertiesImpl rmpsIn = null;
        Identifier inSeqId = null;
        BigInteger inMessageNumber = null;
       
        if (isApplicationMessage) {
                       
            rmpsIn = (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(context, false);
           
            if (null != rmpsIn && null != rmpsIn.getSequence()) {
                inSeqId = rmpsIn.getSequence().getIdentifier();
                inMessageNumber = rmpsIn.getSequence().getMessageNumber();
            }
            LOG.fine("inbound sequence: " + (null == inSeqId ? "null" : inSeqId.getValue()));

            // not for partial responses to oneway requests

            if (!(isServerSide() && BindingContextUtils.isOnewayTransport(context))) {

                if (!ContextUtils.isRequestor(context)) {
                    assert null != inSeqId;
                }
               
                // get the current sequence, requesting the creation of a new one if necessary
               
                SourceSequence seq = getSequence(inSeqId, context, maps);
                assert null != seq;

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

                seq.nextMessageNumber(inSeqId, inMessageNumber);
                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);
                }
            }
        }
       
        // add Acknowledgements (to application messages or explicitly
        // created Acknowledgement messages only)

        if (isApplicationMessage
            || RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)) {
            AttributedURI to = VersionTransformer.convert(maps.getTo());
            assert null != to;
            addAcknowledgements(rmpsOut, inSeqId, to);
        }

        // indicate to the binding that a response is expected from the transport although
View Full Code Here

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

    protected void handleInbound(LogicalMessageContext context) throws SequenceFault {

        LOG.entering(getClass().getName(), "handleInbound");
        RMProperties rmps = RMContextUtils.retrieveRMProperties(context, false);
       
        final AddressingPropertiesImpl maps = ContextUtils.retrieveMAPs(context, false, false);
        assert null != maps;

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

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

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

            org.objectweb.celtix.ws.addressing.EndpointReferenceType to = null;
            try {
                EndpointReferenceType acksTo = null;
                RelatesToType relatesTo = null;
                if (isServerSide()) {
                    AddressingPropertiesImpl inMaps = ContextUtils
                        .retrieveMAPs(context, false, false);
                    inMaps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
                    acksTo = RMUtils.createReference(inMaps.getTo().getValue());
                    to = inMaps.getReplyTo();   
                    getServant().setUnattachedIdentifier(inSeqId);
                    relatesTo = ContextUtils.WSA_OBJECT_FACTORY.createRelatesToType();
                    DestinationSequence inSeq = getDestination().getSequence(inSeqId);
                    relatesTo.setValue(inSeq != null ? inSeq.getCorrelationID() : null);
                } else {
View Full Code Here

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

        return (AbstractBindingBase)serverBinding;
    }
   
    private boolean isApplicationMessage(SOAPMessageContext context) {
        boolean isApplicationMessage = true;
        AddressingPropertiesImpl maps =
            ContextUtils.retrieveMAPs(context, false, true);
       
        if (null == maps) {
            return false;
        }
     
        // ensure the appropriate version of WS-Addressing is used      
        maps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);

        String action = null;
        if (maps != null && null != maps.getAction()) {
            action = maps.getAction().getValue();
        }
        if (RMUtils.getRMConstants().getCreateSequenceAction().equals(action)
            || RMUtils.getRMConstants().getCreateSequenceResponseAction().equals(action)
            || RMUtils.getRMConstants().getTerminateSequenceAction().equals(action)
            || RMUtils.getRMConstants().getLastMessageAction().equals(action)
View Full Code Here

Examples of org.objectweb.celtix.bus.ws.addressing.AddressingPropertiesImpl

       
        ContextUtils.storeUsingAddressing(true, getObjectMessageContext());

        getObjectMessageContext().setRequestorRole(true);
       
        AddressingProperties maps = new AddressingPropertiesImpl();
        AttributedURIType actionURI = ContextUtils.WSA_OBJECT_FACTORY.createAttributedURIType();
        actionURI.setValue(RMUtils.getRMConstants().getTerminateSequenceAction());
        maps.setAction(actionURI);
        ContextUtils.storeMAPs(maps, getObjectMessageContext(), true, true, true, true);
       
        setMessageParameters(seq);
       
        setOneway(true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.