I'm working with rampart samples to better understand dynamic
configuration of usernameToken context. I'm trying to do the following;

 ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(args[1], 
args[1] + "/conf/axis2.xml");
        
        ServiceClient client = new ServiceClient(ctx, null);

        //programmatically enable "rampart" module
        client.engageModule( new javax.xml.namespace.QName("rampart"));

        Options options = new Options();        
   
        options.setAction("urn:echo");
        options.setTo(new EndpointReference(args[0]));
   
        //set user context
   
        OutflowConfiguration ofc = new OutflowConfiguration();

        try {
            ofc.setActionItems("UsernameToken");
            ofc.setUser("bob1");

ofc.setPasswordCallbackClass("org.apache.rampart.samples.sample03.PWCBHandler");
            ofc.setPasswordType("PasswordText");
            
            options.setProperty(  WSSHandlerConstants.OUTFLOW_SECURITY,
ofc.getProperty());

            client.setOptions(options);
        
            OMElement response = client.sendReceive(getPayload("Hello
world"));
        
            System.out.println(response);

        }
        catch(Throwable t) {
            t.printStackTrace();
        }


When i execute the client, I get the following error message:

java.lang.ClassCastException:
org.apache.axiom.om.impl.llom.OMElementImpl
     [java]     at
org.apache.axiom.soap.impl.llom.SOAPFaultImpl.getCode(SOAPFaultImpl.java:101)
     [java]     at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:308)
     [java]     at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579)
     [java]     at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
     [java]     at
org.apache.rampart.samples.sample03.DynamicUTClient.main(Unknown Source)




The sample code works when I configure the usernameToken from within the
client's axis2.xml file. However, when i try to set it programmatically,
I end up with this error message. I have included rampart's jar as part
of my client classpath. Can anyone please let me know how to resolve
this.

Thanks,
vedha




-- 
Vedha Vijayan
Senior Software Engineer
Comergent Technologies Inc.
Ph:  650 232 5833
Fax: 650 232 6010
Email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to