Hi Andrei,
I am trying to add username token policy from a policy server using a
custom policy interceptor for my webservice. the code for interceptor is
public class CustomPolicyInterceptor extends
AbstractPhaseInterceptor<SoapMessage> {
public CustomPolicyInterceptor(){
super(Phase.SETUP);
getBefore().add(PolicyOutInterceptor.class.getName());
}
private static final long serialVersionUID = -5248428637449096540L;
public void handleMessage(SoapMessage message)
{
try{
PolicyBuilder builder =
message.getExchange().getBus().getExtension(PolicyBuilder.class);
InputStream is = new
URL("http://localhost:8880/policy/policy.xml").openStream();
Policy effectivePolicy = builder.getPolicy(is) ;
message.put(PolicyConstants.POLICY_OVERRIDE,
effectivePolicy);
}
catch(Exception e) {
System.out.println("error");
}
}
}
and my bean.xml is
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
<bean id="myPasswordCallback" class="service.ServerPasswordCallback" />
<jaxws:endpoint id="doubleit"
implementor="service.DoubleItPortTypeImpl"
wsdlLocation="wsdl/DoubleIt.wsdl"
address="/doubleitexternal">
<jaxws:outInterceptors>
<bean class="service.CustomPolicyInterceptor">
</bean>
</jaxws:outInterceptors>
<jaxws:properties>
<entry key="ws-security.callback-handler"
value-ref="myPasswordCallback"/>
</jaxws:properties>
</jaxws:endpoint>
</beans>
But policy is not getting applied to my webservice. can you please tell me
what changes I need to make.
--
View this message in context:
http://cxf.547215.n5.nabble.com/Dynamicall-y-define-WS-Policy-in-CXF-tp5713085p5721747.html
Sent from the cxf-user mailing list archive at Nabble.com.