Freeman Yue Fang created CXF-9276:
-------------------------------------

             Summary: WS-RM client with an anonymous AcksTo and a decoupled 
endpoint: every two-way call fails
                 Key: CXF-9276
                 URL: https://issues.apache.org/jira/browse/CXF-9276
             Project: CXF
          Issue Type: Bug
          Components: WS-* Components
            Reporter: Freeman Yue Fang


A JAX-WS client with WS-RM, a WS-Addressing decoupled endpoint and an anonymous 
AcksTo for its sequences:

{code:xml}
<wsrm-mgr:sourcePolicy acksTo="http://www.w3.org/2005/08/addressing/anonymous"/>
{code}

calling a CXF WS-RM service: every two-way call fails with

{noformat}
org.apache.cxf.endpoint.ClientImpl$IllegalEmptyResponseException: Response 
message did not contain proper response data. Expected: {...}greetMeResponse
{noformat}

This happens with WS-RM 1.0 and 1.1, whether the acknowledgement or the reply 
reaches the client first.

h3. What happens

For a sequence with an anonymous AcksTo, the service sends its acknowledgements 
in the HTTP response to each request, as WS-RM 1.1 section 3.9 requires ("the 
RM Destination MUST Transmit any SequenceAcknowledgement headers for the 
created Sequence in a SOAP envelope to be Transmitted on the protocol 
binding-specific back-channel"). The application reply goes to the decoupled 
endpoint. So the client gets, for each call:
* HTTP 200 for the request, with a SequenceAcknowledgement message (RelatesTo 
unspecified, empty body), which it processes as a partial response;
* the reply, at the decoupled endpoint.

When it processes the acknowledgement, 
RMSoapInInterceptor.updateServiceModelInfo() switches the exchange of the call 
to the RM protocol endpoint, with the SequenceAcknowledgement operation, and 
makes it one-way. The reply is correlated to the same exchange, so it is then 
read against the SequenceAcknowledgement operation, has no result, and the call 
fails.

WS-RM 1.1 section 3.9 also says the RM Source "SHOULD process 
SequenceAcknowledgement header blocks that are included in any message it 
receives", and that processing a piggy-backed acknowledgement must not affect 
the processing of the original message.

h3. Fix

For a partial response to an application request, RMSoapInInterceptor should 
process the RM headers without updating the exchange, so that the reply is read 
against the application operation.

h3. Reproduce

ProtocolVariationsTest (systests/ws-rm), with testDefaultDecoupled and AcksTo 
set to anonymous:

{code:java}
greeterBus.getExtension(RMManager.class).getSourcePolicy().setAcksTo(Names.WSA_ANONYMOUS_ADDRESS);
assertEquals("ONE", greeter.greetMe("one")); // fails
{code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to