Search in sources :

Example 1 with IgnorablePolicyInterceptorProvider

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);
    }
}
Also used : PolicyInterceptorProviderRegistry(org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry) IgnorablePolicyInterceptorProvider(org.apache.cxf.ws.policy.IgnorablePolicyInterceptorProvider) PolicyInterceptorProvider(org.apache.cxf.ws.policy.PolicyInterceptorProvider) IgnorablePolicyInterceptorProvider(org.apache.cxf.ws.policy.IgnorablePolicyInterceptorProvider)

Example 2 with IgnorablePolicyInterceptorProvider

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);
    }
}
Also used : Bus(org.apache.cxf.Bus) PolicyInterceptorProviderRegistry(org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry) IgnorablePolicyInterceptorProvider(org.apache.cxf.ws.policy.IgnorablePolicyInterceptorProvider) UseThreadBusFeature(org.jboss.wsf.stack.cxf.client.UseThreadBusFeature) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Aggregations

IgnorablePolicyInterceptorProvider (org.apache.cxf.ws.policy.IgnorablePolicyInterceptorProvider)2 PolicyInterceptorProviderRegistry (org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry)2 URL (java.net.URL)1 QName (javax.xml.namespace.QName)1 Service (javax.xml.ws.Service)1 Bus (org.apache.cxf.Bus)1 PolicyInterceptorProvider (org.apache.cxf.ws.policy.PolicyInterceptorProvider)1 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)1 UseThreadBusFeature (org.jboss.wsf.stack.cxf.client.UseThreadBusFeature)1 JBossWSTest (org.jboss.wsf.test.JBossWSTest)1 Test (org.junit.Test)1