I merged a fix to CXF to trigger the outbound security policy handlers when there is no security binding specified in the WSDL, but there is a SignedParts policy. I think this may be why your use-case is not working. Could you submit a test-case that reproduces the problem + I will take a closer look? Alternatively, grab the latest CXF source from the 2.7.x-fixes branch, build it + try it with your client code to see if it works.
Colm. On Tue, Dec 17, 2013 at 12:56 PM, marudu <[email protected]> wrote: > Hi, > Thanks for your reply. > i followed your instructions and modified from the existing code. but still > i am having the same error. > could u review my code and tell what exactly did wrong. > > Client Code : > > public class Client { > private static final String NAMESPACE = " > http://edt.health.ontario.ca/"; > private static final QName SERVICE_QNAME = new QName(NAMESPACE, > "EDTService"); > > public static void main(String args[]) throws Exception { > try { > > SpringBusFactory bf = new SpringBusFactory(); > URL busFile = EDTClient.class.getResource("Client.xml"); > Bus bus = bf.createBus(busFile.toString()); > SpringBusFactory.setDefaultBus(bus); > SpringBusFactory.setThreadDefaultBus(bus); > //certificate > System.setProperty("javax.net.ssl.trustStore","C:/Program > Files/Java/jre7/lib/security/cacerts"); > > System.setProperty("javax.net.ssl.trustStorePassword","changeit"); > URL wsdl = new > URL("https://ws.ebs.health.gov.on.ca:1441/EDTService/EDTService?wsdl"); > Service service = Service.create(wsdl, SERVICE_QNAME); > QName portQName = new QName(NAMESPACE, "EDTPort"); > EDTDelegate x509Port = > service.getPort(portQName,EDTDelegate.class); > //Add Headers > EbsHeader ebs = new EbsHeader(); > IdpHeader idp = new IdpHeader(); > MsaHeader msa = new MsaHeader(); > //Credentials > > ebs.setSoftwareConformanceKey("32f1-75c5-4sdffee-sda8c0-8dg96e7361760c"); > UUID Audit = UUID.randomUUID(); > String AuditID = Audit.toString(); > ebs.setAuditId(AuditID); > idp.setServiceUserMUID("20432235"); > //Client Request > x509Port.list("BE",ResourceStatus.DOWNLOADABLE, new > BigInteger("1"),ebs, msa, idp); > System.out.println("result..."); > ((java.io.Closeable)x509Port).close(); > bus.shutdown(true); > > } > catch(Exception e) > { > e.printStackTrace(); > } > } > } > > > > Configurations > > Client.xml > > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:http="http://cxf.apache.org/transports/http/configuration" > xmlns:jaxws="http://cxf.apache.org/jaxws" > xmlns:cxf="http://cxf.apache.org/core" > xmlns:p="http://cxf.apache.org/policy" > xmlns:sec="http://cxf.apache.org/configuration/security" > 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 > http://cxf.apache.org/transports/http/configuration > http://cxf.apache.org/schemas/configuration/http-conf.xsd > http://cxf.apache.org/configuration/security > http://cxf.apache.org/schemas/configuration/security.xsd > http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd > http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd"> > <cxf:bus> > <cxf:features> > <p:policies/> > <cxf:logging/> > </cxf:features> > </cxf:bus> > <jaxws:client name="{http://edt.health.ontario.ca/}EDTPort" > createdFromAPI="true"> > <jaxws:properties> > <entry key="ws-security.callback-handler" > value="demo.wssec.common.CommonPasswordCallback"/> > <entry key="ws-security.encryption.properties" > value="etc/Client_Encrypt.properties"/> > <entry key="ws-security.encryption.username" value="entrustCA"/> > <entry key="ws-security.signature.properties" > value="etc/Client_Sign.properties"/> > <entry key="ws-security.signature.username" value="client-keystore"/> > </jaxws:properties> > </jaxws:client> > > </beans> > > CommonPasswordCallback.java > > public CommonPasswordCallback() { > passwords.put("username", "Password"); > } > > Note: > I installed server root certificates in cacerts file > self signed & encryption keystore (stored in local) > WSDL Link: > https://ws.ebs.health.gov.on.ca:1441/EDTService/EDTService?wsdl > > error : > org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives > can be satisfied. > > > > > > > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/Eclipse-CXF-and-WS-SecurityPolicy-tp5737811p5737921.html > Sent from the cxf-user mailing list archive at Nabble.com. > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
