cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yadav, Yogendra \(IT\)" <Yogendra.Ya...@morganstanley.com>
Subject Adding custom ws-policy assertions
Date Tue, 08 Jul 2008 14:46:22 GMT
Hi,
I want to add a custom ws-policy assertion to an operation like this
(note: I picked up the ws_addressing and ws_policy samples as examples):
(snippet from wsdl)
    <wsdl:portType name="Greeter">
        <wsdl:operation name="sayHi">
            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"
wswa:Action="urn:getQuote">
               <wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy">
                 <wsp:All>
                   <app:Caller
xmlns:app="http://xml.ns.ms.com/app">cc</app:Caller>
                 </wsp:All>
               </wsp:Policy>
	    </wsdl:input>
            <wsdl:output message="tns:sayHiResponse"
name="sayHiResponse" wswa:Action="urn:getQuote" />
        </wsdl:operation>


I added this to client.xml and cxf-servlet.xml
    <cxf:bus>
        <cxf:features>
            <wsa:addressing/>
            <p:policies/>
        </cxf:features>
    </cxf:bus>
    
    <bean id="CallerAssertionBuilder"
 
class="org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuil
der">
        <property name="knownElements">
            <set>
                <bean class="javax.xml.namespace.QName">
                    <constructor-arg value="http://xml.ns.ms.com/app"/>
                    <constructor-arg value="Caller"/>
                </bean>
            </set>
        </property>
    </bean> 
 
When I call the service from Client.java, I get this error ?

Implicit MessageAddressingProperties propagation
------------------------------------------------
Invoking sayHi...
javax.xml.ws.soap.SOAPFaultException: None of the policy alternatives
can be satisfied.
	at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:199)
	at
msjava.cxfutils.jaxws.internal.MSJaxWsClientProxy.invoke(MSJaxWsClientPr
oxy.java:39)
	at $Proxy41.sayHi(Unknown Source)
	at
demo.ws_addressing.client.Client.implicitPropagation(Client.java:96)
	at demo.ws_addressing.client.Client.main(Client.java:71)
Caused by: org.apache.cxf.interceptor.Fault: None of the policy
alternatives can be satisfied.
	at
org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(Abstrac
tPolicyInterceptor.java:58)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:221)
	at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
	at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
	at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
	at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
	... 4 more
Caused by: org.apache.cxf.ws.policy.PolicyException: None of the policy
alternatives can be satisfied.
	at
org.apache.cxf.ws.policy.EffectivePolicyImpl.chooseAlternative(Effective
PolicyImpl.java:124)
	at
org.apache.cxf.ws.policy.EffectivePolicyImpl.initialise(EffectivePolicyI
mpl.java:80)
	at
org.apache.cxf.ws.policy.PolicyEngineImpl.getEffectiveClientRequestPolic
y(PolicyEngineImpl.java:148)
	at
org.apache.cxf.ws.policy.ClientPolicyOutInterceptor.handle(ClientPolicyO
utInterceptor.java:80)
	at
org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(Abstrac
tPolicyInterceptor.java:56)
	... 9 more 
 
Would appreciate any help in this regard.

thanx
-yogen
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to
waive confidentiality or privilege. Use of this email is prohibited when received in error.

Mime
View raw message