Hi,
im trying to contact an axis ws that uses wss4j without using a wsdd config file. Since i switched from the WSDD to the following code, i get the execption mentioned below. any ideas?


AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.ClassCastException: PWCallback
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.lang.ClassCastException: PWCallback at org.apache.ws.axis.security.WSDoAllSender.getPassword(WSDoAllSender.java:855) at org.apache.ws.axis.security.WSDoAllSender.performUTAction(WSDoAllSender.java:465) at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:314) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
   at org.apache.axis.client.Call.invoke(Call.java:2748)
   at org.apache.axis.client.Call.invoke(Call.java:2424)
   at org.apache.axis.client.Call.invoke(Call.java:2347)
   at org.apache.axis.client.Call.invoke(Call.java:1804)
at JCT.service.al.JCTSessionSoapBindingStub.getJobStatus(JCTSessionSoapBindingStub.java:316)
   at JobStatus.main(JobStatus.java:33)

   {http://xml.apache.org/axis/}hostname:erle

java.lang.ClassCastException: PWCallback
   at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:216)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
   at org.apache.axis.client.Call.invoke(Call.java:2748)
   at org.apache.axis.client.Call.invoke(Call.java:2424)
   at org.apache.axis.client.Call.invoke(Call.java:2347)
   at org.apache.axis.client.Call.invoke(Call.java:1804)
at JCT.service.al.JCTSessionSoapBindingStub.getJobStatus(JCTSessionSoapBindingStub.java:316)
   at JobStatus.main(JobStatus.java:33)
Caused by: java.lang.ClassCastException: PWCallback
at org.apache.ws.axis.security.WSDoAllSender.getPassword(WSDoAllSender.java:855) at org.apache.ws.axis.security.WSDoAllSender.performUTAction(WSDoAllSender.java:465) at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:314) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
   ... 7 more



public class JobStatus {

public static void main(String[] args) { try { JCTSessionServiceLocator service = new JCTSessionServiceLocator(); EngineConfiguration clientConfig=createClientConfig();
           service.setEngineConfiguration(clientConfig);
           service.setEngine(new AxisClient(clientConfig));
JCTSession jct = service.getJCTSession();
           Job[] jobs = jct.getJobStatus("rudi", null, null, null);
       }
       catch(Exception e) {
e.printStackTrace();
       }
   }
private static EngineConfiguration createClientConfig() { try {
           SimpleProvider clientConfig=new SimpleProvider();
           Handler securityHandler= (Handler)new WSDoAllSender();

securityHandler.setOption(WSHandlerConstants.ACTION, "UsernameToken"); //securityHandler.setOption(WSHandlerConstants.SIG_PROP_FILE,this.WSS_SIG_PROPERTIES);

           securityHandler.setOption(WSHandlerConstants.USER, "rudi");

securityHandler.setOption(WSHandlerConstants.PW_CALLBACK_CLASS, new PWCallback());
            SimpleChain reqHandler=new SimpleChain();
            SimpleChain respHandler=new SimpleChain();
            // add the handler to the request
            reqHandler.addHandler(securityHandler);
            // add the handler to the response
            respHandler.addHandler(securityHandler);
            Handler pivot=(Handler)new HTTPSender();
            Handler transport=new
           SimpleTargetedChain(reqHandler, pivot, respHandler);

clientConfig.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME,transport); return clientConfig;
       }
       catch(Exception e) {
e.printStackTrace();
           return null;
       }
   }
}


public class PWCallback implements CallbackHandler {

public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

       for (int i = 0; i < callbacks.length; i++) {

           if (callbacks[i] instanceof WSPasswordCallback) {

               WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];

               // set the password given a username
               if("rudi".equals(pc.getIdentifer())) {

                   pc.setPassword("dsgxdgsfsdgfsdgs");
               }
           }
           else {

throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
           }
       }
   }
}


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

Reply via email to