0 Replies Latest reply on Sep 9, 2009 4:13 PM by James Ricci

    Apache CXF and WSS SOAP header

    James Ricci Newbie

      Hey there,

       

      I am new to Apache CXF. I'm posting this question here. I'm not sure if this is the right place, so please excuse me if it isn't.

       

      We are writing a client for a SOAP web service. I used wsdl2java in the Apache CXF download to produce java code which seems to be complete. A very simple example program using the generated code looks something like this:

       

      =====================================

      VehicleService vehService = new VehicleService();

      VehiclePortType vp = vehService.getVehicleHttpPort();

       

      List veh = vp.findVehiclesByVIN("1FTZX1767WKA37840");

      =====================================

       

      The problem that remains is that the service requires us to pass a username and password in a secure SOAP header. Using Axis2 directly, we were able to do this; however, the code generated by Axis2 is too cumbersome to be practical. Using CXF generated much better code; however, I'm not sure how to make this information part of the call.

       

      I saw a class called AuthenticationPolicy that seemed to be what we were looking for, but no way to use it with the above call. I've been round and round the internet trying to find an example or code, but what I've found does not work for a variety of reasons.

       

      This information must be specified at runtime, so we cannot add it to a configuration file of any kind.

       

      Any ideas (including a better place to post this message)?

       

      Thanks for any help

       

      Edited by: jricci9999 on Sep 9, 2009 8:13 PM