use of org.apache.cxf.ws.policy.IgnorablePolicyInterceptorProvider in project jbossws-cxf by jbossws.
the class PolicyInterceptorProviderInstallerInterceptor method handleMessage.
public void handleMessage(Message message) throws Fault {
PolicyInterceptorProviderRegistry reg = message.getExchange().getBus().getExtension(PolicyInterceptorProviderRegistry.class);
Set<PolicyInterceptorProvider> set = reg.get(customPolicyQname);
if (set == null || set.isEmpty()) {
set = new HashSet<PolicyInterceptorProvider>();
set.add(new IgnorablePolicyInterceptorProvider(customPolicyQname));
reg.register(customPolicyQname, set);
}
}
use of org.apache.cxf.ws.policy.IgnorablePolicyInterceptorProvider in project jbossws-cxf by jbossws.
the class PolicyInterceptorProviderTestCase method testUnsupportedPolicy.
/**
* Verifies the policy-enabled client can be configured to ignore a given policy in the wsdl contract
*
* @throws Exception
*/
@Test
@RunAsClient
public void testUnsupportedPolicy() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
PolicyInterceptorProviderRegistry reg = bus.getExtension(PolicyInterceptorProviderRegistry.class);
reg.register(new IgnorablePolicyInterceptorProvider(new QName("http://my.custom.org/policy", "MyPolicy")));
URL wsdlURL = new URL(baseURL + "/jaxws-cxf-policy/PIPService/PIPEndpoint?wsdl");
QName serviceName = new QName("http://policy.cxf.jaxws.ws.test.jboss.org/", "PIPService");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
QName portQName = new QName("http://policy.cxf.jaxws.ws.test.jboss.org/", "PIPEndpointPort");
PIPEndpoint port = (PIPEndpoint) service.getPort(portQName, PIPEndpoint.class);
assertEquals("foo", port.echo("foo"));
} finally {
bus.shutdown(true);
}
}
Aggregations