You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Pete Long <Pe...@gmail.com> on 2014/08/02 08:33:29 UTC

CXF Reliable Messaging Question

Hi All.

Wonder if you can clarify this for me please.

If Reliable Messaging is introduced on our server Web Service, is it
possible to configure such that Reliable Messaging is applicable for
specific operations ?

Eg

We have 2 different clients "1" and "2".
Our Web Service provides two operations "A" and B".

Client 1 will use operation "A" but Reliable Messaging IS NOT required for
this operation.

Client 2 will use operation "B" but Reliable Messaging IS required for this
operation.


Thank you 

Pete



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Reliable-Messaging-Question-tp5747260.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Reliable Messaging Question

Posted by Pete Long <Pe...@gmail.com>.
Hi Andrei,Dennis, 

Appologises for the late response. 

I will now need to put the suggestions to practice .... assuming this
apprach is still taken.

Either way, I have learnt alot from this thread so very much appreciate the
input you both have provided.

Thank you.

Pete



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Reliable-Messaging-Question-tp5747260p5747578.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Reliable Messaging Question

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
On 08/06/2014 12:24 AM, Andrei Shakirin wrote:
> Hi Pete,
>
>> -----Original Message-----
>> From: Pete Long [mailto:PeteLong01@gmail.com]
>> ...
>>
>> Also, do I need to update the WSDL ? if so, what is it I need to do please.
> You do not need to update your WSDL if you use external policy attachments approach.
> PolicyAttachments AppliesTo will reference your WSDL elements.
>
>> Why we are looking at the idea of RM enabled for some operations only is
>> because we have different clients using our web service operations. The
>> operations are specific to a client. Certain clients want RM enabled for the
>> operations they invoke.
> Hmm ... perhaps it makes sense to apply RM Policy as optional even on service or binding level in this case. It will be activated if client uses RM headers in call and ignored if client isn't RM aware. Not sure that will work out of the box, but interesting to try.

Making RM optional on the provider at service or binding level should 
work correctly, as Andrei said. That's just the standard policy handling 
code at work, and AFAIK will work even in older versions of CXF. But 
using CXF 2.7.5 you might have some interoperability problems with other 
web services stacks, so it's better to update to 3.0.x if you can.

Clients should be able to control whether they use RM or not by their 
configuration. You can always supply them with two versions of the WSDL, 
one with WS-Policy RM configuration, the other without, and clients can 
use whichever is appropriate to their needs.

   - Dennis


RE: CXF Reliable Messaging Question

Posted by Andrei Shakirin <as...@talend.com>.
Hi Pete,

> -----Original Message-----
> From: Pete Long [mailto:PeteLong01@gmail.com]
> Sent: Montag, 4. August 2014 20:49
> To: users@cxf.apache.org
> Subject: RE: CXF Reliable Messaging Question
> 
> Hi Andrei,Dennis,
> 
> Thanks Andrei for the response.
> 
> I trust your suggestion is applicable for CXF 2.7.5.
> 
> Also, do I need to update the WSDL ? if so, what is it I need to do please.

You do not need to update your WSDL if you use external policy attachments approach.
PolicyAttachments AppliesTo will reference your WSDL elements.

> 
> Why we are looking at the idea of RM enabled for some operations only is
> because we have different clients using our web service operations. The
> operations are specific to a client. Certain clients want RM enabled for the
> operations they invoke.

Hmm ... perhaps it makes sense to apply RM Policy as optional even on service or binding level in this case. It will be activated if client uses RM headers in call and ignored if client isn't RM aware. Not sure that will work out of the box, but interesting to try.

Regards,
Andrei.

> 
> Eg
> 
> Client A will operations 1,2 - RM needs to be disabled.
> 
> Client B will use operations 3,4 - RM needs to be enabled.
> 
> Many thanks again
> 
> Pete
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Reliable-
> Messaging-Question-tp5747260p5747345.html
> Sent from the cxf-user mailing list archive at Nabble.com.

RE: CXF Reliable Messaging Question

Posted by Pete Long <Pe...@gmail.com>.
Hi Andrei,Dennis, 

Thanks Andrei for the response. 

I trust your suggestion is applicable for CXF 2.7.5.

Also, do I need to update the WSDL ? if so, what is it I need to do please.

Why we are looking at the idea of RM enabled for some operations only is
because we have different clients using our web service operations. The
operations are specific to a client. Certain clients want RM enabled for the
operations they invoke. 

Eg 

Client A will operations 1,2 - RM needs to be disabled.

Client B will use operations 3,4 - RM needs to be enabled.

Many thanks again

Pete




--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Reliable-Messaging-Question-tp5747260p5747345.html
Sent from the cxf-user mailing list archive at Nabble.com.

RE: CXF Reliable Messaging Question

Posted by Andrei Shakirin <as...@talend.com>.
Hi Pete,

> -----Original Message-----
> From: Pete Long [mailto:PeteLong01@gmail.com]
> Sent: Montag, 4. August 2014 11:10
> To: users@cxf.apache.org
> Subject: Re: CXF Reliable Messaging Question
> 
> Hi Andrei,Dennis,
> 
> Many thanks for your response.
> 
> Following on from Dennis's response to
> http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=reply&node
> =5747264
> 
> I am going to use the "Using the Reliable Messaging Feature" approach.
> 
> We are using CXF 2.7.5. Therefore I assume the configuration suggested by
> Andrei is not applicable. However, if it was, would that configuration go into
> the wsdl file ?

Basically it will be necessary to create PolicyAttachment xml file, containing something like this:

<wsp:PolicyAttachment xmlns:wsp="http://www.w3.org/ns/ws-policy">
    <wsp:AppliesTo>
        <wsp:URI>http://apache.org/ExampleService#wsdl11.bindingOperation(HTTPBinding/myOperation)</wsp:URI>
    </wsp:AppliesTo>
   <wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
          <wsp:Policy/>
       </wsam:Addressing>
       <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
           <wsrmp:BaseRetransmissionInterval Milliseconds="10000"/>
       </wsrmp:RMAssertion>
   </wsp:Policy>
</wsp:PolicyAttachment>

and configure this policy attachment on the bus level:

    <cxf:bus>
        <cxf:features>
            <p:policies/>
        </cxf:features>
    </cxf:bus>

    <p:externalAttachment location="myRMPolicyAttachment.xml"/>

Additionally, you have to define RM Policy as optional on the port or binding level, because of reasons mentioned by Dennis:
" but WS-RM Policy still requires that RM be defined (at least as optional) at the port or binding level. I assume the reason for that requirement is so that only one RM session is opened in each direction between the client and the provider, even if RM is being used for multiple operations."

I have never tried this, interesting if this approach work.

Regards,
Andrei.

> 
> If we can't upgrade to CXF 3.0.0 and 2.7.12 , is there another way to configure
> enable Reliable Messaging for specific opertions on our web service interface ?
> 
> 
> Thank you .
> 
> Pete
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Reliable-
> Messaging-Question-tp5747260p5747290.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Reliable Messaging Question

Posted by Pete Long <Pe...@gmail.com>.
Hi Andrei,Dennis,

Many thanks for your response.

Following on from Dennis's response to 
http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=reply&node=5747264

I am going to use the "Using the Reliable Messaging Feature" approach. 

We are using CXF 2.7.5. Therefore I assume the configuration suggested by
Andrei is not applicable. However, if it was, would that configuration go
into the wsdl file ?

If we can't upgrade to CXF 3.0.0 and 2.7.12 , is there another way to
configure enable Reliable Messaging for specific opertions on our web
service interface ?


Thank you .

Pete



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Reliable-Messaging-Question-tp5747260p5747290.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Reliable Messaging Question

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
Hi Andrei,

The PolicyAttachment approach is definitely a nice approach, and I'll 
make sure to cover it in my next training class.

It'd be interesting to try it out to see if it worked as expected on 
CXF, but WS-RM Policy still requires that RM be defined (at least as 
optional) at the port or binding level. I assume the reason for that 
requirement is so that only one RM session is opened in each direction 
between the client and the provider, even if RM is being used for 
multiple operations.

Regards,

   - Dennis

On 08/03/2014 08:56 PM, Andrei Shakirin wrote:
> Hi Dennis,
>
> CXF 3.0.0 and 2.7.12 support wsp:URI syntax of external policy attachments for operations, bindings and messages (in 3.0.0 URIDomainExpressionBuilder is activated by default, in 2.7.12 it is necessary to active it via bus-extensions or spring bean)
> I wonder would this work, if RM policy will be specified for specific operation or message?
> You need something like this:
>
> <wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
>      <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
>          <wsp:Policy/>
>      </wsam:Addressing>
>      <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
>          <wsrmp:BaseRetransmissionInterval Milliseconds="10000"/>
>      </wsrmp:RMAssertion>
> </wsp:Policy>
>
> <wsp:PolicyAttachment xmlns:wsp="http://www.w3.org/ns/ws-policy">
>      <wsp:AppliesTo>
>          <wsp:URI>http://apache.org/ExampleService#wsdl11.bindingOperation(HTTPBinding/myOperation)</wsp:URI>
>      </wsp:AppliesTo>
>      <wsp:PolicyReference URI="RM" />
> </wsp:PolicyAttachment>
>
> The RM interceptors should be activated only for myOperation in ExampleService in this case.
>
> Regards,
> Andrei.
>
>> -----Original Message-----
>> From: Dennis Sosnoski [mailto:dms@sosnoski.com]
>> Sent: Samstag, 2. August 2014 19:20
>> To: users@cxf.apache.org
>> Subject: Re: CXF Reliable Messaging Question
>>
>> Hi Pete,
>>
>> The WS-RM policy specification says that you can *require* RM to be applied
>> at the operation/message level, but to do this you have to also define RM as
>> *optional* for the entire port or binding (http://docs.oasis-open.org/ws-
>> rx/wsrmp/200702/wsrmp-1.2-spec-os.html#_Toc160540909).
>> It also says that not all implementations can actually handle RM only for
>> certain messages. So depending on the implementations involved, if you
>> defined RM as optional for the entire service but required for operation "B" you
>> might or might not get RM applied to operation "A" as well.
>>
>> I'm not sure how a CXF client would handle this configuration, either, since I
>> haven't seen it used in practice.
>>
>>     - Dennis
>>
>> Dennis M. Sosnoski
>> Java Web Services Consulting <http://www.sosnoski.com/consult.html>
>> CXF and Web Services Security Training
>> <http://www.sosnoski.com/training.html>
>> Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>
>>
>> On 08/02/2014 06:33 PM, Pete Long wrote:
>>> Hi All.
>>>
>>> Wonder if you can clarify this for me please.
>>>
>>> If Reliable Messaging is introduced on our server Web Service, is it
>>> possible to configure such that Reliable Messaging is applicable for
>>> specific operations ?
>>>
>>> Eg
>>>
>>> We have 2 different clients "1" and "2".
>>> Our Web Service provides two operations "A" and B".
>>>
>>> Client 1 will use operation "A" but Reliable Messaging IS NOT required
>>> for this operation.
>>>
>>> Client 2 will use operation "B" but Reliable Messaging IS required for
>>> this operation.
>>>
>>>
>>> Thank you
>>>
>>> Pete
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://cxf.547215.n5.nabble.com/CXF-Reliable-Messaging-Question-tp5747
>>> 260.html Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>


RE: CXF Reliable Messaging Question

Posted by Andrei Shakirin <as...@talend.com>.
Hi Dennis,

CXF 3.0.0 and 2.7.12 support wsp:URI syntax of external policy attachments for operations, bindings and messages (in 3.0.0 URIDomainExpressionBuilder is activated by default, in 2.7.12 it is necessary to active it via bus-extensions or spring bean)
I wonder would this work, if RM policy will be specified for specific operation or message? 
You need something like this:

<wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
        <wsp:Policy/>
    </wsam:Addressing>
    <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
        <wsrmp:BaseRetransmissionInterval Milliseconds="10000"/>
    </wsrmp:RMAssertion>
</wsp:Policy>

<wsp:PolicyAttachment xmlns:wsp="http://www.w3.org/ns/ws-policy">
    <wsp:AppliesTo>
        <wsp:URI>http://apache.org/ExampleService#wsdl11.bindingOperation(HTTPBinding/myOperation)</wsp:URI>
    </wsp:AppliesTo>
    <wsp:PolicyReference URI="RM" />
</wsp:PolicyAttachment>

The RM interceptors should be activated only for myOperation in ExampleService in this case. 

Regards,
Andrei.

> -----Original Message-----
> From: Dennis Sosnoski [mailto:dms@sosnoski.com]
> Sent: Samstag, 2. August 2014 19:20
> To: users@cxf.apache.org
> Subject: Re: CXF Reliable Messaging Question
> 
> Hi Pete,
> 
> The WS-RM policy specification says that you can *require* RM to be applied
> at the operation/message level, but to do this you have to also define RM as
> *optional* for the entire port or binding (http://docs.oasis-open.org/ws-
> rx/wsrmp/200702/wsrmp-1.2-spec-os.html#_Toc160540909).
> It also says that not all implementations can actually handle RM only for
> certain messages. So depending on the implementations involved, if you
> defined RM as optional for the entire service but required for operation "B" you
> might or might not get RM applied to operation "A" as well.
> 
> I'm not sure how a CXF client would handle this configuration, either, since I
> haven't seen it used in practice.
> 
>    - Dennis
> 
> Dennis M. Sosnoski
> Java Web Services Consulting <http://www.sosnoski.com/consult.html>
> CXF and Web Services Security Training
> <http://www.sosnoski.com/training.html>
> Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>
> 
> On 08/02/2014 06:33 PM, Pete Long wrote:
> > Hi All.
> >
> > Wonder if you can clarify this for me please.
> >
> > If Reliable Messaging is introduced on our server Web Service, is it
> > possible to configure such that Reliable Messaging is applicable for
> > specific operations ?
> >
> > Eg
> >
> > We have 2 different clients "1" and "2".
> > Our Web Service provides two operations "A" and B".
> >
> > Client 1 will use operation "A" but Reliable Messaging IS NOT required
> > for this operation.
> >
> > Client 2 will use operation "B" but Reliable Messaging IS required for
> > this operation.
> >
> >
> > Thank you
> >
> > Pete
> >
> >
> >
> > --
> > View this message in context:
> > http://cxf.547215.n5.nabble.com/CXF-Reliable-Messaging-Question-tp5747
> > 260.html Sent from the cxf-user mailing list archive at Nabble.com.
> >


Re: CXF Reliable Messaging Question

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
Hi Pete,

The WS-RM policy specification says that you can *require* RM to be 
applied at the operation/message level, but to do this you have to also 
define RM as *optional* for the entire port or binding 
(http://docs.oasis-open.org/ws-rx/wsrmp/200702/wsrmp-1.2-spec-os.html#_Toc160540909). 
It also says that not all implementations can actually handle RM only 
for certain messages. So depending on the implementations involved, if 
you defined RM as optional for the entire service but required for 
operation "B" you might or might not get RM applied to operation "A" as 
well.

I'm not sure how a CXF client would handle this configuration, either, 
since I haven't seen it used in practice.

   - Dennis

Dennis M. Sosnoski
Java Web Services Consulting <http://www.sosnoski.com/consult.html>
CXF and Web Services Security Training 
<http://www.sosnoski.com/training.html>
Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>

On 08/02/2014 06:33 PM, Pete Long wrote:
> Hi All.
>
> Wonder if you can clarify this for me please.
>
> If Reliable Messaging is introduced on our server Web Service, is it
> possible to configure such that Reliable Messaging is applicable for
> specific operations ?
>
> Eg
>
> We have 2 different clients "1" and "2".
> Our Web Service provides two operations "A" and B".
>
> Client 1 will use operation "A" but Reliable Messaging IS NOT required for
> this operation.
>
> Client 2 will use operation "B" but Reliable Messaging IS required for this
> operation.
>
>
> Thank you
>
> Pete
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Reliable-Messaging-Question-tp5747260.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>