Hi Dennis, Yes, it should be possible to use policies from WSDL in case of Dispatch client:
Service service = new Service(wsdl, SERVICE_NAME); Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD); Of course, implementing own interceptor, parse policy using Neethy and applying to message property PolicyConstants.POLICY_OVERRIDE is also possible way, but requires more implementation efforts. Regards, Andrei. > -----Original Message----- > From: Dennis Sosnoski [mailto:[email protected]] > Sent: Dienstag, 27. August 2013 01:05 > To: [email protected] > Subject: Re: Apply WS-Policy to XML string representing soap request? > > Hi Andrei, > > Do you know if the policy would be picked up from the WSDL in this case, > with a Dispatch client? If not, what's the easiest way to set it in the client > code? I mentioned using an interceptor, but that seems more complex than > necessary. > > Thanks, > > - Dennis > > On 08/27/2013 12:27 AM, Andrei Shakirin wrote: > > Hi, > > > > You can specify policy using jaxws.features in this case, example of spring > configuration: > > > > <jaxws:client id="CRMServiceClient" > name="{http://services.talend.org/CRMService}CRMServiceProvider" > > xmlns:serviceNamespace="http://services.talend.org/CRMService" > > serviceClass="org.talend.services.crmservice.CRMService" > > serviceName="serviceNamespace:CRMServiceProvider" > > endpointName="serviceNamespace:CRMServicePort" > > address="${endpoint.prefix}/CRMServiceProvider"> > > <jaxws:features> > > <p:policies> > > <wsp:PolicyReference URI="classpath:/saml.policy"/> > > </p:policies> > > </jaxws:features> > > </jaxws:client> > > > > See http://cxf.apache.org/docs/how-to-define-policies.html for details. > > > > Regards, > > Andrei. > > > >> -----Original Message----- > >> From: Sam [mailto:[email protected]] > >> Sent: Montag, 26. August 2013 12:36 > >> To: [email protected] > >> Subject: Apply WS-Policy to XML string representing soap request? > >> > >> Hi all, > >> > >> Is it possible for CXF to apply WS-Policy to xml string representing > >> soap request directly? > >> > >> I looked at all the demo client code I run for WSDL first web service > >> with WS- Policy and the client code is always generated by the maven > >> plugin cxf- codegen-plugin. > >> > >> Nothing wrong with that. But looking at SoapUI makes me wander if > >> it's possible to simply feed XML string as soap request to CXF, then > >> CXF will do all the hard work of applying WS-Policy, just like SoapUI. > >> > >> Thanks > >> Sam
