Unsure if this is the problem, but if you're declaring the cxf-rt-ws-policy dependency (as shown here: http://www.jroller.com/gmazza/entry/cxf_usernametoken_profile#UTCXF2) WS-Policy processing will activate, probably not what you want given that you're explicitly configuring the WSS4J interceptors.

This blog entry might also be of help: http://www.jroller.com/gmazza/entry/cxf_x509_profile

Regards,
Glen


On 10/20/2011 10:41 AM, Tomaž Rotovnik wrote:
Hi

I would like to create WS client to consume a .Net web service as
defined in WSDL:

http://webservices.gama-system.com/earchive/ServiceA3.svc?wsdl which
includes inport statement ->
http://webservices.gama-system.com/earchive/ServiceA3.svc?wsdl=wsdl1

I think I made some mistake defining WS-security policies and
TIMESTAMP-ing action, but unfortunately I still get the error:
org.apache.cxf.ws.policy.PolicyException: No encryption crypto object
found

I implemented WS-client with metro library and it worked, but I can't
get it to work with CFX library.

I would be very grateful if someone could give me some hint.

Best regards

Tomaz


My client.java code look like this:

...
         System.out.println("Create Web Service Client...");
         new SpringBusFactory().createBus("META-INF/cxf.xml");
         EArchiveService ss = new EArchiveService();
         IEArchive port = ss.getEArchiveSecureReliableIEArchive(new
AddressingFeature());

         Client client = ClientProxy.getClient(port);
         Endpoint cxfEndpoint = client.getEndpoint();
         Map<String,Object>  outProps = new HashMap<String,Object>();
         outProps.put(WSHandlerConstants.ACTION,
WSHandlerConstants.TIMESTAMP);
         WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
         cxfEndpoint.getOutInterceptors().add(wssOut);

         System.out.println("Call Web Service Operation..."); 
         System.out.println("Server said: " + port.isRunning());      
...

AND cxf.xml file look like this:

<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:cxf="http://cxf.apache.org/core";
xmlns:wsa="http://cxf.apache.org/ws/addressing";
   xmlns:http="http://cxf.apache.org/transports/http/configuration";
xmlns:jaxws="http://cxf.apache.org/jaxws";
xmlns:p="http://cxf.apache.org/policy";
xmlns:sec="http://cxf.apache.org/configuration/security";
   xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy";
xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager";
xsi:schemaLocation="http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://schemas.xmlsoap.org/ws/2005/02/rm/policy
http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
http://cxf.apache.org/ws/rm/manager
http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
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/configuration/security
http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/policy
     http://cxf.apache.org/schemas/policy.xsd";>
   <cxf:bus>
     <cxf:features>
       <p:policies/>
       <cxf:logging/>
       <wsa:addressing/>
       <wsrm-mgr:reliableMessaging>
         <wsrm-policy:RMAssertion>
           <wsrm-policy:BaseRetransmissionInterval
Milliseconds="4000"/>
           <wsrm-policy:AcknowledgementInterval Milliseconds="2000"/>
         </wsrm-policy:RMAssertion>
         <wsrm-mgr:destinationPolicy>
           <wsrm-mgr:acksPolicy intraMessageThreshold="0" />
         </wsrm-mgr:destinationPolicy>
       </wsrm-mgr:reliableMessaging>
     </cxf:features>
   </cxf:bus>

   <http:conduit
name="{http://tempuri.org/}EArchiveSecureReliable_IEArchive.http-conduit";>
      <http:tlsClientParameters disableCNCheck="true">
             <sec:keyManagers keyPassword="pass">
                 <sec:keyStore type="JKS" password="pass"
file="META-INF/private.jks"/>
             </sec:keyManagers>
             <sec:trustManagers>
                 <sec:keyStore type="JKS" password="pass"
file="META-INF/test.jks"/>
             </sec:trustManagers>
         </http:tlsClientParameters>
       <http:client AllowChunking="false"/>
   </http:conduit>

</beans>


--
Glen Mazza
Talend - http://www.talend.com/apache
Blog - http://www.jroller.com/gmazza
Twitter - glenmazza

Reply via email to