Hi Colm,

thanks for the help.

The server side wss4j properties file looks like this:

org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=keyStorePassword
org.apache.ws.security.crypto.merlin.alias.password=myAliasPassword
org.apache.ws.security.crypto.merlin.keystore.alias=myAlias
org.apache.ws.security.crypto.merlin.file=META-INF/publicstore.jks

Do I need other informations in the spring beans.xml file to tell the server
I am using just a plain taxt password and not a CallbackHandler
implementation?

Anyway I have another problem.
I updated the project to CXF 2.0.1 and the following code seems not to work
anymore:

URL wsdlURL = new URL("file:C:/schema/CreditReportSimple.wsdl");

ReportService service = new ReportService(wsdlURL, SERVICE_NAME);
CreditReportPortType port =
service.getCreditReportPortType();org.apache.cxf.endpoint.Client client =
org.apache.cxf.frontend.ClientProxy.getClient(service); 

When I call the last line of code now I get the following exception:

Exception in thread "main" java.lang.IllegalArgumentException: not a proxy
instance
        at java.lang.reflect.Proxy.getInvocationHandler(Unknown Source)
        at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:87)
        at
org.netbeans.j2ee.wsdl.creditreport.CreditReportPortTypeClient.main(CreditReportPortTypeClient.java:40)

Any Idea??!

Thanks

Davide



O hEigeartaigh, Colm wrote:
> 
> Hi Davide,
> 
>> PasswordHandler is on the classpath and implements CallbackHandler....
>> anyway I don't know exactly what to code inside it! 
>> Is it necessary in my case ( I don't want autenthication).
> 
> You have two options for specifying a password, either in the properties
> file or via a custom implementation of the CallbackHandler interface.
> You must implement one of these approaches, as wss4j needs to know the
> password to access the private key stored in your keystore, in order to
> perform decryption etc.
> 
> I don't know why you're getting a ClassNotFoundException for your
> CallbackHandler implementation, you need to provide more information...
> 
> Have a look at the unit tests for WS-security in CXF to see how
> configuration is done (in particular look at
> org.apache.cxf.ws.security.wss4j.TestPwdCallback).
> 
> Colm.
> 
> 
> -----Original Message-----
> From: Davide Gesino [mailto:[EMAIL PROTECTED] 
> Sent: 21 August 2007 10:57
> To: cxf-user@incubator.apache.org
> Subject: cxf encryption
> 
> 
> Hello,
> 
> I would like to set up a working example of a ws client and ws server
> exchanging encrypted messages.
> I have tried to set up an example following both the cxf wiki and the
> xfire
> tutorial, but I haven/t been able to make it work properly.
> 
> I don't want to provide authentication (at this stage), just encryption.
> 
> in this example I have a client that calls an endpoint deployed on
> tomcat.
> I have created a public and private keystore (following the cxf wiki).
> 
> ###################
> #this is the client code:
> ###################
> 
> ReportService service = new ReportService(wsdlURL, SERVICE_NAME);
> CreditReportPortType port = service.getCreditReportPortType();
>               
> // adding encryption
> org.apache.cxf.endpoint.Client client =
> org.apache.cxf.frontend.ClientProxy.getClient(service); 
> org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
>               
> Map<String, String> outProps = new HashMap<String,String>();
> outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.ENCRYPT);
> outProps.put(WSHandlerConstants.USER, "myAlias");
> 
> //Configuration of public key used to encrypt message goes to properties
> file.
> outProps.put(WSHandlerConstants.ENC_PROP_FILE,"org/codehaus/xfire/client
> /outsecurity_enc.properties");
> 
> WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
> cxfEndpoint.getOutInterceptors().add(wssOut);
> cxfEndpoint.getOutInterceptors().add(new SAAJOutInterceptor());
>       
> System.out.println("Invoking creditReportOperation...");
> org.netbeans.j2ee.wsdl.creditreport.CreditReport
> _creditReportOperation_part1 = port.creditReportOperation(new
> CreditQuery());
> System.out.println(_creditReportOperation_part1);
> 
> 
> #####################################################
> #while on the server side  I have configured this endpoint and its
> interceptors
> #####################################################
> 
> ...
> <jaxws:endpoint id="italo" address="/CreditReportPortType"
>       
> implementor="org.netbeans.j2ee.wsdl.creditreport.CreditReportPortTypeImp
> l">
>             <jaxws:inInterceptors>
>          <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
>          <bean
> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
>            <constructor-arg>
>              <map>
>               <entry key="action" value="Encrypt" />
> 
>               <entry key="decryptionPropFile"
> value="META-INF/insecurity_enc.properties"
> />
>                    <entry key="passwordCallbackClass"
> value="org.netbeans.j2ee.wsdl.creditreport.PasswordHandler" />
> </map>
>       </constructor-arg>
>       </bean>
> </jaxws:inInterceptors>
> </jaxws:endpoint>
> 
> This example was working fine before introducing the encryption.
> 
> When I run this program I get this error on the tomcat console:
> 
> Caused by: java.lang.ClassNotFoundException:
> org.netbeans.j2ee.wsdl.creditreport.PasswordHandler
> 
> PasswordHandler is on the classpath and implements CallbackHandler....
> anyway I don't know exactly what to code inside it! 
> Is it necessary in my case ( I don't want autenthication).
> i tried to omiss this entry but i get a different error.
> 
> Caused by: org.apache.ws.security.WSSecurityException: WSHandler: no
> reference in callback property
> 
> so this entry seems to be necessary....
> 
> Does anyone know where coud be the problem?
> Does anyone know has a working example that could fit my case?
> 
> Many thanks!!!!
> 
> Davide 
> 
> 
>       
> 
> -- 
> View this message in context:
> http://www.nabble.com/cxf-encryption-tf4304218.html#a12251696
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
> 
> 

-- 
View this message in context: 
http://www.nabble.com/cxf-encryption-tf4304218.html#a12269549
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to