Search in sources :

Example 11 with AckRequestedType

use of org.apache.cxf.ws.rm.v200702.AckRequestedType in project cxf by apache.

the class EncoderDecoder10Impl method decodeAckRequestedType.

public AckRequestedType decodeAckRequestedType(Element elem) throws JAXBException {
    Unmarshaller unmarshaller = getContext().createUnmarshaller();
    JAXBElement<org.apache.cxf.ws.rm.v200502.AckRequestedType> jaxbElement = unmarshaller.unmarshal(elem, org.apache.cxf.ws.rm.v200502.AckRequestedType.class);
    return VersionTransformer.convert(jaxbElement.getValue());
}
Also used : AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 12 with AckRequestedType

use of org.apache.cxf.ws.rm.v200702.AckRequestedType in project cxf by apache.

the class EncoderDecoder11Impl method buildHeaders.

@Override
protected void buildHeaders(SequenceType seq, Collection<SequenceAcknowledgement> acks, Collection<AckRequestedType> reqs, boolean last, List<Header> headers) throws JAXBException {
    if (null != seq) {
        LOG.log(Level.FINE, "encoding sequence into RM header");
        JAXBElement<SequenceType> element = RMUtils.getWSRMFactory().createSequence(seq);
        headers.add(new SoapHeader(element.getName(), element, getDataBinding(), true));
    }
    if (null != acks) {
        LOG.log(Level.FINE, "encoding sequence acknowledgement(s) into RM header");
        for (SequenceAcknowledgement ack : acks) {
            headers.add(new SoapHeader(new QName(getConstants().getWSRMNamespace(), RMConstants.SEQUENCE_ACK_NAME), ack, getDataBinding()));
        }
    }
    if (null != reqs) {
        LOG.log(Level.FINE, "encoding acknowledgement request(s) into RM header");
        for (AckRequestedType req : reqs) {
            headers.add(new SoapHeader(new QName(getConstants().getWSRMNamespace(), RMConstants.ACK_REQUESTED_NAME), RMUtils.getWSRMFactory().createAckRequested(req), getDataBinding()));
        }
    }
}
Also used : QName(javax.xml.namespace.QName) SoapHeader(org.apache.cxf.binding.soap.SoapHeader) AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType) CreateSequenceType(org.apache.cxf.ws.rm.v200702.CreateSequenceType) TerminateSequenceType(org.apache.cxf.ws.rm.v200702.TerminateSequenceType) CloseSequenceType(org.apache.cxf.ws.rm.v200702.CloseSequenceType) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Example 13 with AckRequestedType

use of org.apache.cxf.ws.rm.v200702.AckRequestedType in project cxf by apache.

the class EncoderDecoder11Impl method decodeAckRequestedType.

public AckRequestedType decodeAckRequestedType(Element elem) throws JAXBException {
    Unmarshaller unmarshaller = getContext().createUnmarshaller();
    JAXBElement<AckRequestedType> jaxbElement = unmarshaller.unmarshal(elem, AckRequestedType.class);
    return jaxbElement.getValue();
}
Also used : AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 14 with AckRequestedType

use of org.apache.cxf.ws.rm.v200702.AckRequestedType in project cxf by apache.

the class RMSoapInInterceptor method decodeHeaders.

public void decodeHeaders(SoapMessage message, List<Header> headers, RMProperties rmps) {
    try {
        Collection<SequenceAcknowledgement> acks = new ArrayList<>();
        Collection<AckRequestedType> requested = new ArrayList<>();
        String rmUri = null;
        EncoderDecoder codec = null;
        Iterator<Header> iter = headers.iterator();
        while (iter.hasNext()) {
            Object node = iter.next().getObject();
            if (node instanceof Element) {
                Element elem = (Element) node;
                if (Node.ELEMENT_NODE != elem.getNodeType()) {
                    continue;
                }
                String ns = elem.getNamespaceURI();
                if (rmUri == null && (RM10Constants.NAMESPACE_URI.equals(ns) || RM11Constants.NAMESPACE_URI.equals(ns))) {
                    LOG.log(Level.FINE, "set RM namespace {0}", ns);
                    rmUri = ns;
                    rmps.exposeAs(rmUri);
                }
                if (rmUri != null && rmUri.equals(ns)) {
                    if (codec == null) {
                        String wsauri = null;
                        AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false, false);
                        if (maps == null) {
                            RMConfiguration config = getManager(message).getEffectiveConfiguration(message);
                            wsauri = config.getAddressingNamespace();
                        } else {
                            wsauri = maps.getNamespaceURI();
                        }
                        ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, wsauri);
                        if (protocol == null) {
                            LOG.log(Level.WARNING, "NAMESPACE_ERROR_MSG", wsauri);
                            break;
                        }
                        codec = protocol.getCodec();
                    }
                    String localName = elem.getLocalName();
                    LOG.log(Level.FINE, "decoding RM header {0}", localName);
                    if (RMConstants.SEQUENCE_NAME.equals(localName)) {
                        rmps.setSequence(codec.decodeSequenceType(elem));
                        rmps.setCloseSequence(codec.decodeSequenceTypeCloseSequence(elem));
                    } else if (RMConstants.SEQUENCE_ACK_NAME.equals(localName)) {
                        acks.add(codec.decodeSequenceAcknowledgement(elem));
                    } else if (RMConstants.ACK_REQUESTED_NAME.equals(localName)) {
                        requested.add(codec.decodeAckRequestedType(elem));
                    }
                }
            }
        }
        if (!acks.isEmpty()) {
            rmps.setAcks(acks);
        }
        if (!requested.isEmpty()) {
            rmps.setAcksRequested(requested);
        }
    } catch (JAXBException ex) {
        LOG.log(Level.WARNING, "SOAP_HEADER_DECODE_FAILURE_MSG", ex);
    }
}
Also used : EncoderDecoder(org.apache.cxf.ws.rm.EncoderDecoder) Element(org.w3c.dom.Element) JAXBException(javax.xml.bind.JAXBException) ArrayList(java.util.ArrayList) RMConfiguration(org.apache.cxf.ws.rm.RMConfiguration) Header(org.apache.cxf.headers.Header) AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement) ProtocolVariation(org.apache.cxf.ws.rm.ProtocolVariation)

Aggregations

AckRequestedType (org.apache.cxf.ws.rm.v200702.AckRequestedType)14 SequenceAcknowledgement (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)6 SequenceType (org.apache.cxf.ws.rm.v200702.SequenceType)5 CloseSequenceType (org.apache.cxf.ws.rm.v200702.CloseSequenceType)4 CreateSequenceType (org.apache.cxf.ws.rm.v200702.CreateSequenceType)4 TerminateSequenceType (org.apache.cxf.ws.rm.v200702.TerminateSequenceType)4 Unmarshaller (javax.xml.bind.Unmarshaller)3 QName (javax.xml.namespace.QName)3 SoapHeader (org.apache.cxf.binding.soap.SoapHeader)3 ArrayList (java.util.ArrayList)2 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)2 RMProperties (org.apache.cxf.ws.rm.RMProperties)2 Identifier (org.apache.cxf.ws.rm.v200702.Identifier)2 Test (org.junit.Test)2 JAXBException (javax.xml.bind.JAXBException)1 Header (org.apache.cxf.headers.Header)1 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)1 EncoderDecoder (org.apache.cxf.ws.rm.EncoderDecoder)1 ProtocolVariation (org.apache.cxf.ws.rm.ProtocolVariation)1 RMConfiguration (org.apache.cxf.ws.rm.RMConfiguration)1