Search in sources :

Example 1 with AckRequestedType

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

the class EncoderDecoder10AImpl method decodeAckRequestedType.

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

Example 2 with AckRequestedType

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

the class RMOutInterceptor method addAckRequest.

/**
 * Add AcknowledgementRequested to message if needed. The AckRequest mode set either in the message
 * properties or in the source policy is used to determine whether AcknowledgementRequested is always
 * added, never added, or added only when we're waiting for the acknowledgement to a previously-sent
 * message.
 *
 * @param msg
 * @param rmpsIn
 * @param seq
 * @param sequence
 */
protected void addAckRequest(Message msg, RMProperties rmpsIn, SourceSequence seq, SequenceType sequence) {
    AckRequestModeType mode = (AckRequestModeType) msg.get(RMMessageConstants.ACK_REQUEST_MODE);
    if (mode == null) {
        mode = AckRequestModeType.PENDING;
        SourcePolicyType policy = getManager().getSourcePolicy();
        if (policy.isSetAckRequestMode()) {
            mode = policy.getAckRequestMode();
        }
    }
    if (AckRequestModeType.ALWAYS == mode || (mode == AckRequestModeType.PENDING && seq.needAcknowledge(rmpsIn.getMessageNumber()))) {
        Collection<AckRequestedType> reqs = rmpsIn.getAcksRequested();
        if (reqs == null) {
            reqs = new ArrayList<>();
        }
        Identifier identifier = new Identifier();
        identifier.setValue(sequence.getIdentifier().getValue());
        AckRequestedType ackRequest = new AckRequestedType();
        ackRequest.setIdentifier(identifier);
        reqs.add(ackRequest);
        rmpsIn.setAcksRequested(reqs);
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) AckRequestModeType(org.apache.cxf.ws.rm.manager.AckRequestModeType) SourcePolicyType(org.apache.cxf.ws.rm.manager.SourcePolicyType) AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType)

Example 3 with AckRequestedType

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

the class VersionTransformer method convert.

/**
 * Convert 200502 wsrm:SequenceAcknowledgement with 200508 WS-Addressing namespace to internal form.
 *
 * @param exposed (non-<code>null</code>)
 * @return converted
 */
public static AckRequestedType convert(org.apache.cxf.ws.rm.v200502wsa15.AckRequestedType exposed) {
    AckRequestedType internal = new AckRequestedType();
    internal.setIdentifier(convert(exposed.getIdentifier()));
    addAll(exposed.getAny(), internal.getAny());
    putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
    return internal;
}
Also used : AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType)

Example 4 with AckRequestedType

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

the class VersionTransformer method convert.

/**
 * Convert 200502 wsrm:SequenceAcknowledgement with 200408 WS-Addressing namespace to internal form.
 *
 * @param exposed (non-<code>null</code>)
 * @return converted
 */
public static AckRequestedType convert(org.apache.cxf.ws.rm.v200502.AckRequestedType exposed) {
    AckRequestedType internal = new AckRequestedType();
    internal.setIdentifier(convert(exposed.getIdentifier()));
    addAll(exposed.getAny(), internal.getAny());
    putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
    return internal;
}
Also used : AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType)

Example 5 with AckRequestedType

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

the class RMSoapInInterceptorTest method testDecodeAcksRequested.

@Test
public void testDecodeAcksRequested() throws XMLStreamException {
    SoapMessage message = setUpInboundMessage("resources/Retransmission.xml");
    RMSoapInInterceptor codec = new RMSoapInInterceptor();
    codec.handleMessage(message);
    RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
    Collection<AckRequestedType> requested = rmps.getAcksRequested();
    assertNotNull(requested);
    assertEquals(1, requested.size());
    AckRequestedType ar = requested.iterator().next();
    assertNotNull(ar);
    assertEquals(ar.getIdentifier().getValue(), SEQ_IDENTIFIER);
    SequenceType s = rmps.getSequence();
    assertNotNull(s);
    assertEquals(s.getIdentifier().getValue(), SEQ_IDENTIFIER);
    assertEquals(s.getMessageNumber(), MSG2_MESSAGE_NUMBER);
    assertNull(rmps.getAcks());
}
Also used : AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) RMProperties(org.apache.cxf.ws.rm.RMProperties) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) Test(org.junit.Test)

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