You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by yetanotherandi <an...@gmail.com> on 2012/04/04 17:01:24 UTC

Apache CXF, Policies and Message Predicates

Hallo everyone!

I would like to use Apache CXF with webservice policies. So I want to use
some policy assertions, e.g. message predicates like that one: 

<wsp:ExactlyOne>
  <wsp:All>
    <wsp:MessagePredicate>
      count(wsp:GetBody(.)/*) > 0 
    </wsp:MessagePredicate>
  </wsp:All>
</wsp:ExactlyOne>

Can I use something like this in CXF? When I am using a very simple message
predicate (see below) I get this error message: 

"org.apache.cxf.interceptor.Fault: None of the policy alternatives can be
satisfied." 

<wsp:Policy wsu:Id="policy-600686d0-b855-4f6b-9dac-9218547d462c"> 
        <wsp:ExactlyOne>
                        <wsp:All>
                           <wsp:MessagePredicate wsp:Usage="wsp:Required">
                              wsp:Body() 
                           </wsp:MessagePredicate>
                        </wsp:All>
        </wsp:ExactlyOne>
</wsp:Policy>

Furthermore I get another error message during the start: 

WARNUNG: No assertion builder for type
{http://www.w3.org/ns/ws-policy}MessagePredicate registered. 

So where do I register this assertion builder?

I have already discovered this site:
http://cxf.apache.org/docs/ws-policy.html
And I have also found and used this sample:
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_policy/

Therefore I would like to know how good the support of WSP is. Can I check
messages and their content, e.g. like in the example above? 

Thanks for any answers in advance!

Kind regards

Andi

--
View this message in context: http://cxf.547215.n5.nabble.com/Apache-CXF-Policies-and-Message-Predicates-tp5618022p5618022.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Apache CXF, Policies and Message Predicates

Posted by wuschl68 <we...@leiopython.de>.
Hi Daniel,

thanks very much for your answer. Sadly enough there is a initiative to
standardize webservices for insurances in Germany, called 'BiPRO', that
propagates the use of MessagePredicate policies for technical validation.
So I guess there is no other easy solution than to parse that xpath stuff as
xslt and to evaluate the message against that xpath expression...

Thanks again,
Wulf



--
View this message in context: http://cxf.547215.n5.nabble.com/Apache-CXF-Policies-and-Message-Predicates-tp5618022p5750649.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Apache CXF, Policies and Message Predicates

Posted by Daniel Kulp <dk...@apache.org>.
At this point, CXF does not support any of the MessagePredicate things.

One of the main reasons is that the official released WS-Policy spec from W3C does not include it.   See the schema:
http://www.w3.org/ns/ws-policy/

It’s something that Microsoft had in their pre-official versions, but the working group removed it as WS-Policy became standardized.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com



> On Nov 2, 2014, at 1:58 AM, wuschl68 <we...@leiopython.de> wrote:
> 
> Has anybody solves the messagepredicate problem yet?
> I spent days trying to get it working and haven't made it yet. 
> 
> Any help would greatly be appreciated.
> 
> Thanks,
> Wulf
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Apache-CXF-Policies-and-Message-Predicates-tp5618022p5750572.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: Apache CXF, Policies and Message Predicates

Posted by wuschl68 <we...@leiopython.de>.
Has anybody solves the messagepredicate problem yet?
I spent days trying to get it working and haven't made it yet. 

Any help would greatly be appreciated.

Thanks,
Wulf



--
View this message in context: http://cxf.547215.n5.nabble.com/Apache-CXF-Policies-and-Message-Predicates-tp5618022p5750572.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Apache CXF, Policies and Message Predicates

Posted by yetanotherandi <an...@gmail.com>.
Hallo again,

I am now using a different namespace like 

xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" instead of
"http://www.w3.org/ns/ws-policy"

and the error message disappears. That's good, I hope.

But now also very wrong policies are not applied.

<wsp:Policy wsu:Id="policy-600686d0-b855-4f6b-9dac-9218547d462c">  
        <wsp:ExactlyOne>
                        <wsp:All>
                           <wsp:MessagePredicate wsp:Usage="wsp:Required">
                              thisshouldproduceanerrorbutdoesnot
                           </wsp:MessagePredicate>
                        </wsp:All>
        </wsp:ExactlyOne>
</wsp:Policy>

I have also used the ws-policy sample from the apache cxf distribution and
therefore put these polices inside of the attachement ("addr-external"). Is
this a good setup?

--
View this message in context: http://cxf.547215.n5.nabble.com/Apache-CXF-Policies-and-Message-Predicates-tp5618022p5619690.html
Sent from the cxf-user mailing list archive at Nabble.com.