WSPolicyFeature policyFeature = new WSPolicyFeature(); policyFeature.setPolicies(policies); locatorEndpoint.getFeatures().add(policyFeature); policyFeature.initialize(sr, currentBus);
@Override public void initialize(Client client, Bus bus) { Endpoint endpoint = client.getEndpoint(); Policy p = initializeEndpointPolicy(endpoint, bus); PolicyEngine pe = bus.getExtension(PolicyEngine.class); EndpointInfo ei = endpoint.getEndpointInfo(); EndpointPolicy ep = pe.getClientEndpointPolicy(ei, null, null); pe.setClientEndpointPolicy(ei, ep.updatePolicy(p, createMessage(endpoint, bus))); }
public void setupServer(boolean mtomRequired, String address) throws Exception { getStaticBus().getExtension(PolicyEngine.class).setAlternativeSelector( new FirstAlternativeSelector()); JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); sf.setServiceBean(new EchoService()); sf.setBus(getStaticBus()); sf.setAddress(address); WSPolicyFeature policyFeature = new WSPolicyFeature(); List<Element> policyElements = new ArrayList<>(); if (mtomRequired) { policyElements.add(StaxUtils.read( getClass().getResourceAsStream("mtom-policy.xml")) .getDocumentElement()); } else { policyElements.add(StaxUtils.read( getClass().getResourceAsStream("mtom-policy-optional.xml")) .getDocumentElement()); } policyFeature.setPolicyElements(policyElements); sf.getFeatures().add(policyFeature); sf.create(); }
features.add(new WSPolicyFeature(securityArguments.getPolicy()));
QName portQName = new QName(NAMESPACE, "DoubleItPlaintextPort"); WSPolicyFeature policyFeature = new WSPolicyFeature(); Element policyElement = StaxUtils.read(getClass().getResourceAsStream("plaintext-pass-timestamp-policy.xml")).getDocumentElement(); policyFeature.setPolicyElements(Collections.singletonList(policyElement));
features.add(new WSPolicyFeature(securityArguments.getPolicy()));
WSPolicyFeature policyFeature = new WSPolicyFeature(); policyFeature.setPolicies(policies); policyFeature.initialize(server, bus);
@Override public void initialize(Client client, Bus bus) { Endpoint endpoint = client.getEndpoint(); Policy p = initializeEndpointPolicy(endpoint, bus); PolicyEngine pe = bus.getExtension(PolicyEngine.class); EndpointInfo ei = endpoint.getEndpointInfo(); EndpointPolicy ep = pe.getClientEndpointPolicy(ei, null, null); pe.setClientEndpointPolicy(ei, ep.updatePolicy(p, createMessage(endpoint, bus))); }
WSPolicyFeature policyFeature = new WSPolicyFeature(); policyFeature.setPolicies(policies); policyFeature.initialize(server, bus);
@Override public void initialize(Server server, Bus bus) { Endpoint endpoint = server.getEndpoint(); Policy p = initializeEndpointPolicy(endpoint, bus); PolicyEngine pe = bus.getExtension(PolicyEngine.class); EndpointInfo ei = endpoint.getEndpointInfo(); EndpointPolicy ep = pe.getServerEndpointPolicy(ei, null, null); pe.setServerEndpointPolicy(ei, ep.updatePolicy(p, createMessage(endpoint, bus))); // Add policy to the service model (and consequently to the WSDL) // FIXME - ideally this should probably be moved up to where the policies are applied to the // endpoint, rather than this late. As a consequence of its location, you have to declare a // ws policy feature on every endpoint in order to get any policy attachments into the // wsdl. Alternatively add to the WSDLServiceBuilder somehow. ServiceModelPolicyUpdater pu = new ServiceModelPolicyUpdater(ei); for (PolicyProvider pp : ((PolicyEngineImpl) pe).getPolicyProviders()) { if (pp instanceof ExternalAttachmentProvider) { pu.addPolicyAttachments(((ExternalAttachmentProvider) pp).getAttachments()); } } }
WSPolicyFeature policyFeature = new WSPolicyFeature(); policyFeature.setPolicies(policies); policyFeature.initialize(client, bus);
@Override public void initialize(Server server, Bus bus) { Endpoint endpoint = server.getEndpoint(); Policy p = initializeEndpointPolicy(endpoint, bus); PolicyEngine pe = bus.getExtension(PolicyEngine.class); EndpointInfo ei = endpoint.getEndpointInfo(); EndpointPolicy ep = pe.getServerEndpointPolicy(ei, null, null); pe.setServerEndpointPolicy(ei, ep.updatePolicy(p, createMessage(endpoint, bus))); // Add policy to the service model (and consequently to the WSDL) // FIXME - ideally this should probably be moved up to where the policies are applied to the // endpoint, rather than this late. As a consequence of its location, you have to declare a // ws policy feature on every endpoint in order to get any policy attachments into the // wsdl. Alternatively add to the WSDLServiceBuilder somehow. ServiceModelPolicyUpdater pu = new ServiceModelPolicyUpdater(ei); for (PolicyProvider pp : ((PolicyEngineImpl) pe).getPolicyProviders()) { if (pp instanceof ExternalAttachmentProvider) { pu.addPolicyAttachments(((ExternalAttachmentProvider) pp).getAttachments()); } } }
WSPolicyFeature policyFeature = new WSPolicyFeature(); policyFeature.setPolicies(policies); policyFeature.initialize(client, bus);