You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by Michael Rudolf <mi...@t-online.de> on 2005/12/06 19:50:24 UTC

ClassCast exception with PW callback class

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: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Michael Rudolf <mi...@t-online.de>.
Hi,
thx for the reply. I am using Axis 1.2.1 and WSS4J 1.0. I switched to 
using the Callback ref. I also set the MUST_UNDERSTAND option in the 
WSHandlerConstants to "false". Now it works at least. What modification 
do you mean?
Thanks!
Michael

>Michael,
>
>strange....the correct spelling of the mustunderstand flag
>ist "mustUnderstand" (attributes are case sensitive). In the
>error (fault) report I see a wrong spelling "MustUnderstand" but
>I cannot see how this gets set.
>
>Is there any modification somewhere because WSS4J uses the correct
>spelling (see WSConstants).
>
>Which version of Axis and WSS4J do you use?
>
>BTW, you may use tha cklass instead of the name using the
>parameter "passwordCallbackRef" (WSHandlerConstants.PW_CALLBACK_REF).
>
>Regards,
>Werner
>
>
>Michael Rudolf wrote:
>  
>
>>I still have a problem with this type of invocation. Now i get the
>>following exception:
>>
>>
>>AxisFault
>>faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
>>faultSubcode:
>>faultString: Did not understand &quot;MustUnderstand&quot; header(s):
>>faultActor:
>>faultNode:
>>faultDetail:
>>   {http://xml.apache.org/axis/}stackTrace:
>>   at
>>org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
>>
>>   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>   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
>>al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>>   at JobStatus.main(JobStatus.java:35)
>>
>>   {http://xml.apache.org/axis/}hostname:erle
>>
>>Did not understand "MustUnderstand" header(s):
>>   at
>>org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
>>
>>   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>   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
>>al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>>   at JobStatus.main(JobStatus.java:35)
>>
>>
>>
>>This is my WSDD file. When i use this to configure Axis everything works
>>fine.
>>Thanks for any help!
>>Michael
>>
>>
>><deployment xmlns="http://xml.apache.org/axis/wsdd/"
>>xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>>
>><transport name="http"
>>pivot="java:org.apache.axis.transport.http.HTTPSender"/>
>>
>> <globalConfiguration >
>>
>>  <requestFlow >
>>
>>   <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
>>
>>    <parameter name="action" value="UsernameToken"/>
>>
>>    <parameter name="passwordCallbackClass" value="PWCallback"/>
>>
>>   </handler>
>>
>>  </requestFlow >
>>
>> </globalConfiguration >
>>
>></deployment>
>>
>>    
>>
>>>Ok found a solution for this one....needed to pass a String for the
>>>PWCallback class, not the class itself.
>>>
>>>      
>>>
>>>>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: wss4j-dev-unsubscribe@ws.apache.org
>>>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Michael Rudolf <mi...@t-online.de>.
Hi,
thx for the reply. I am using Axis 1.2.1 and WSS4J 1.0. I switched to 
using the Callback ref. I also set the MUST_UNDERSTAND option in the 
WSHandlerConstants to "false". Now it works at least. What modification 
do you mean?
Thanks!
Michael

>Michael,
>
>strange....the correct spelling of the mustunderstand flag
>ist "mustUnderstand" (attributes are case sensitive). In the
>error (fault) report I see a wrong spelling "MustUnderstand" but
>I cannot see how this gets set.
>
>Is there any modification somewhere because WSS4J uses the correct
>spelling (see WSConstants).
>
>Which version of Axis and WSS4J do you use?
>
>BTW, you may use tha cklass instead of the name using the
>parameter "passwordCallbackRef" (WSHandlerConstants.PW_CALLBACK_REF).
>
>Regards,
>Werner
>
>
>Michael Rudolf wrote:
>  
>
>>I still have a problem with this type of invocation. Now i get the
>>following exception:
>>
>>
>>AxisFault
>>faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
>>faultSubcode:
>>faultString: Did not understand &quot;MustUnderstand&quot; header(s):
>>faultActor:
>>faultNode:
>>faultDetail:
>>   {http://xml.apache.org/axis/}stackTrace:
>>   at
>>org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
>>
>>   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>   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
>>al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>>   at JobStatus.main(JobStatus.java:35)
>>
>>   {http://xml.apache.org/axis/}hostname:erle
>>
>>Did not understand "MustUnderstand" header(s):
>>   at
>>org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
>>
>>   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>   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
>>al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>>   at JobStatus.main(JobStatus.java:35)
>>
>>
>>
>>This is my WSDD file. When i use this to configure Axis everything works
>>fine.
>>Thanks for any help!
>>Michael
>>
>>
>><deployment xmlns="http://xml.apache.org/axis/wsdd/"
>>xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>>
>><transport name="http"
>>pivot="java:org.apache.axis.transport.http.HTTPSender"/>
>>
>> <globalConfiguration >
>>
>>  <requestFlow >
>>
>>   <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
>>
>>    <parameter name="action" value="UsernameToken"/>
>>
>>    <parameter name="passwordCallbackClass" value="PWCallback"/>
>>
>>   </handler>
>>
>>  </requestFlow >
>>
>> </globalConfiguration >
>>
>></deployment>
>>
>>    
>>
>>>Ok found a solution for this one....needed to pass a String for the
>>>PWCallback class, not the class itself.
>>>
>>>      
>>>
>>>>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: wss4j-dev-unsubscribe@ws.apache.org
>>>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Werner Dittmann <We...@t-online.de>.
Michael,

strange....the correct spelling of the mustunderstand flag
ist "mustUnderstand" (attributes are case sensitive). In the
error (fault) report I see a wrong spelling "MustUnderstand" but
I cannot see how this gets set.

Is there any modification somewhere because WSS4J uses the correct
spelling (see WSConstants).

Which version of Axis and WSS4J do you use?

BTW, you may use tha cklass instead of the name using the
parameter "passwordCallbackRef" (WSHandlerConstants.PW_CALLBACK_REF).

Regards,
Werner


Michael Rudolf wrote:
> I still have a problem with this type of invocation. Now i get the
> following exception:
> 
> 
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
> faultSubcode:
> faultString: Did not understand &quot;MustUnderstand&quot; header(s):
> faultActor:
> faultNode:
> faultDetail:
>    {http://xml.apache.org/axis/}stackTrace:
>    at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
> 
>    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>    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
> al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>    at JobStatus.main(JobStatus.java:35)
> 
>    {http://xml.apache.org/axis/}hostname:erle
> 
> Did not understand "MustUnderstand" header(s):
>    at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
> 
>    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>    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
> al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>    at JobStatus.main(JobStatus.java:35)
> 
> 
> 
> This is my WSDD file. When i use this to configure Axis everything works
> fine.
> Thanks for any help!
> Michael
> 
> 
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> 
> <transport name="http"
> pivot="java:org.apache.axis.transport.http.HTTPSender"/>
> 
>  <globalConfiguration >
> 
>   <requestFlow >
> 
>    <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
> 
>     <parameter name="action" value="UsernameToken"/>
> 
>     <parameter name="passwordCallbackClass" value="PWCallback"/>
> 
>    </handler>
> 
>   </requestFlow >
> 
>  </globalConfiguration >
> 
> </deployment>
> 
>>
>> Ok found a solution for this one....needed to pass a String for the
>> PWCallback class, not the class itself.
>>
>>> 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: wss4j-dev-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Werner Dittmann <We...@t-online.de>.
Michael,

strange....the correct spelling of the mustunderstand flag
ist "mustUnderstand" (attributes are case sensitive). In the
error (fault) report I see a wrong spelling "MustUnderstand" but
I cannot see how this gets set.

Is there any modification somewhere because WSS4J uses the correct
spelling (see WSConstants).

Which version of Axis and WSS4J do you use?

BTW, you may use tha cklass instead of the name using the
parameter "passwordCallbackRef" (WSHandlerConstants.PW_CALLBACK_REF).

Regards,
Werner


Michael Rudolf wrote:
> I still have a problem with this type of invocation. Now i get the
> following exception:
> 
> 
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
> faultSubcode:
> faultString: Did not understand &quot;MustUnderstand&quot; header(s):
> faultActor:
> faultNode:
> faultDetail:
>    {http://xml.apache.org/axis/}stackTrace:
>    at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
> 
>    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>    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
> al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>    at JobStatus.main(JobStatus.java:35)
> 
>    {http://xml.apache.org/axis/}hostname:erle
> 
> Did not understand "MustUnderstand" header(s):
>    at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
> 
>    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>    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
> al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>    at JobStatus.main(JobStatus.java:35)
> 
> 
> 
> This is my WSDD file. When i use this to configure Axis everything works
> fine.
> Thanks for any help!
> Michael
> 
> 
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> 
> <transport name="http"
> pivot="java:org.apache.axis.transport.http.HTTPSender"/>
> 
>  <globalConfiguration >
> 
>   <requestFlow >
> 
>    <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
> 
>     <parameter name="action" value="UsernameToken"/>
> 
>     <parameter name="passwordCallbackClass" value="PWCallback"/>
> 
>    </handler>
> 
>   </requestFlow >
> 
>  </globalConfiguration >
> 
> </deployment>
> 
>>
>> Ok found a solution for this one....needed to pass a String for the
>> PWCallback class, not the class itself.
>>
>>> 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: wss4j-dev-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Michael Rudolf <mi...@t-online.de>.
Thx! that did it....

>Michael,
>
>in your code (Java code) you set the handler as the request _and_ the
>response handler. See your coding:
>
>             reqHandler.addHandler(securityHandler);
>             // add the handler to the response
>             respHandler.addHandler(securityHandler);
>             Handler pivot=(Handler)new HTTPSender();
>             Handler transport=new
>             SimpleTargetedChain(reqHandler, pivot, respHandler);
>
>In the WSDD you use this handler as the request handler only. Using
>the WSDoAllSender as response handler produces this wrong result :-) .
>
>Regards,
>Werner
>
>
>Michael Rudolf wrote:
>  
>
>>I still have a problem with this type of invocation. Now i get the
>>following exception:
>>
>>
>>AxisFault
>>faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
>>faultSubcode:
>>faultString: Did not understand &quot;MustUnderstand&quot; header(s):
>>faultActor:
>>faultNode:
>>faultDetail:
>>   {http://xml.apache.org/axis/}stackTrace:
>>   at
>>org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
>>
>>   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>   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
>>al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>>   at JobStatus.main(JobStatus.java:35)
>>
>>   {http://xml.apache.org/axis/}hostname:erle
>>
>>Did not understand "MustUnderstand" header(s):
>>   at
>>org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
>>
>>   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>   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
>>al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>>   at JobStatus.main(JobStatus.java:35)
>>
>>
>>
>>This is my WSDD file. When i use this to configure Axis everything works
>>fine.
>>Thanks for any help!
>>Michael
>>
>>
>><deployment xmlns="http://xml.apache.org/axis/wsdd/"
>>xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>>
>><transport name="http"
>>pivot="java:org.apache.axis.transport.http.HTTPSender"/>
>>
>> <globalConfiguration >
>>
>>  <requestFlow >
>>
>>   <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
>>
>>    <parameter name="action" value="UsernameToken"/>
>>
>>    <parameter name="passwordCallbackClass" value="PWCallback"/>
>>
>>   </handler>
>>
>>  </requestFlow >
>>
>> </globalConfiguration >
>>
>></deployment>
>>
>>    
>>
>>>Ok found a solution for this one....needed to pass a String for the
>>>PWCallback class, not the class itself.
>>>
>>>      
>>>
>>>>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: wss4j-dev-unsubscribe@ws.apache.org
>>>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Michael Rudolf <mi...@t-online.de>.
Thx! that did it....

>Michael,
>
>in your code (Java code) you set the handler as the request _and_ the
>response handler. See your coding:
>
>             reqHandler.addHandler(securityHandler);
>             // add the handler to the response
>             respHandler.addHandler(securityHandler);
>             Handler pivot=(Handler)new HTTPSender();
>             Handler transport=new
>             SimpleTargetedChain(reqHandler, pivot, respHandler);
>
>In the WSDD you use this handler as the request handler only. Using
>the WSDoAllSender as response handler produces this wrong result :-) .
>
>Regards,
>Werner
>
>
>Michael Rudolf wrote:
>  
>
>>I still have a problem with this type of invocation. Now i get the
>>following exception:
>>
>>
>>AxisFault
>>faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
>>faultSubcode:
>>faultString: Did not understand &quot;MustUnderstand&quot; header(s):
>>faultActor:
>>faultNode:
>>faultDetail:
>>   {http://xml.apache.org/axis/}stackTrace:
>>   at
>>org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
>>
>>   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>   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
>>al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>>   at JobStatus.main(JobStatus.java:35)
>>
>>   {http://xml.apache.org/axis/}hostname:erle
>>
>>Did not understand "MustUnderstand" header(s):
>>   at
>>org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
>>
>>   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>   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
>>al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>>   at JobStatus.main(JobStatus.java:35)
>>
>>
>>
>>This is my WSDD file. When i use this to configure Axis everything works
>>fine.
>>Thanks for any help!
>>Michael
>>
>>
>><deployment xmlns="http://xml.apache.org/axis/wsdd/"
>>xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>>
>><transport name="http"
>>pivot="java:org.apache.axis.transport.http.HTTPSender"/>
>>
>> <globalConfiguration >
>>
>>  <requestFlow >
>>
>>   <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
>>
>>    <parameter name="action" value="UsernameToken"/>
>>
>>    <parameter name="passwordCallbackClass" value="PWCallback"/>
>>
>>   </handler>
>>
>>  </requestFlow >
>>
>> </globalConfiguration >
>>
>></deployment>
>>
>>    
>>
>>>Ok found a solution for this one....needed to pass a String for the
>>>PWCallback class, not the class itself.
>>>
>>>      
>>>
>>>>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: wss4j-dev-unsubscribe@ws.apache.org
>>>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Werner Dittmann <We...@t-online.de>.
Michael,

in your code (Java code) you set the handler as the request _and_ the
response handler. See your coding:

             reqHandler.addHandler(securityHandler);
             // add the handler to the response
             respHandler.addHandler(securityHandler);
             Handler pivot=(Handler)new HTTPSender();
             Handler transport=new
             SimpleTargetedChain(reqHandler, pivot, respHandler);

In the WSDD you use this handler as the request handler only. Using
the WSDoAllSender as response handler produces this wrong result :-) .

Regards,
Werner


Michael Rudolf wrote:
> I still have a problem with this type of invocation. Now i get the
> following exception:
> 
> 
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
> faultSubcode:
> faultString: Did not understand &quot;MustUnderstand&quot; header(s):
> faultActor:
> faultNode:
> faultDetail:
>    {http://xml.apache.org/axis/}stackTrace:
>    at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
> 
>    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>    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
> al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>    at JobStatus.main(JobStatus.java:35)
> 
>    {http://xml.apache.org/axis/}hostname:erle
> 
> Did not understand "MustUnderstand" header(s):
>    at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
> 
>    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>    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
> al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>    at JobStatus.main(JobStatus.java:35)
> 
> 
> 
> This is my WSDD file. When i use this to configure Axis everything works
> fine.
> Thanks for any help!
> Michael
> 
> 
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> 
> <transport name="http"
> pivot="java:org.apache.axis.transport.http.HTTPSender"/>
> 
>  <globalConfiguration >
> 
>   <requestFlow >
> 
>    <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
> 
>     <parameter name="action" value="UsernameToken"/>
> 
>     <parameter name="passwordCallbackClass" value="PWCallback"/>
> 
>    </handler>
> 
>   </requestFlow >
> 
>  </globalConfiguration >
> 
> </deployment>
> 
>>
>> Ok found a solution for this one....needed to pass a String for the
>> PWCallback class, not the class itself.
>>
>>> 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: wss4j-dev-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Werner Dittmann <We...@t-online.de>.
Michael,

in your code (Java code) you set the handler as the request _and_ the
response handler. See your coding:

             reqHandler.addHandler(securityHandler);
             // add the handler to the response
             respHandler.addHandler(securityHandler);
             Handler pivot=(Handler)new HTTPSender();
             Handler transport=new
             SimpleTargetedChain(reqHandler, pivot, respHandler);

In the WSDD you use this handler as the request handler only. Using
the WSDoAllSender as response handler produces this wrong result :-) .

Regards,
Werner


Michael Rudolf wrote:
> I still have a problem with this type of invocation. Now i get the
> following exception:
> 
> 
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
> faultSubcode:
> faultString: Did not understand &quot;MustUnderstand&quot; header(s):
> faultActor:
> faultNode:
> faultDetail:
>    {http://xml.apache.org/axis/}stackTrace:
>    at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
> 
>    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>    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
> al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>    at JobStatus.main(JobStatus.java:35)
> 
>    {http://xml.apache.org/axis/}hostname:erle
> 
> Did not understand "MustUnderstand" header(s):
>    at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
> 
>    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>    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
> al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
>    at JobStatus.main(JobStatus.java:35)
> 
> 
> 
> This is my WSDD file. When i use this to configure Axis everything works
> fine.
> Thanks for any help!
> Michael
> 
> 
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> 
> <transport name="http"
> pivot="java:org.apache.axis.transport.http.HTTPSender"/>
> 
>  <globalConfiguration >
> 
>   <requestFlow >
> 
>    <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
> 
>     <parameter name="action" value="UsernameToken"/>
> 
>     <parameter name="passwordCallbackClass" value="PWCallback"/>
> 
>    </handler>
> 
>   </requestFlow >
> 
>  </globalConfiguration >
> 
> </deployment>
> 
>>
>> Ok found a solution for this one....needed to pass a String for the
>> PWCallback class, not the class itself.
>>
>>> 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: wss4j-dev-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Michael Rudolf <mi...@t-online.de>.
I still have a problem with this type of invocation. Now i get the 
following exception:


AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
 faultSubcode:
 faultString: Did not understand &quot;MustUnderstand&quot; header(s):
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}stackTrace:
    at 
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    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 
al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
    at JobStatus.main(JobStatus.java:35)

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

Did not understand "MustUnderstand" header(s):
    at 
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    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 
al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
    at JobStatus.main(JobStatus.java:35)



This is my WSDD file. When i use this to configure Axis everything works 
fine.
Thanks for any help!
Michael


<deployment xmlns="http://xml.apache.org/axis/wsdd/" 
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 <transport name="http" 
pivot="java:org.apache.axis.transport.http.HTTPSender"/>

  <globalConfiguration >

   <requestFlow >

    <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >

     <parameter name="action" value="UsernameToken"/>

     <parameter name="passwordCallbackClass" value="PWCallback"/>

    </handler>

   </requestFlow >

  </globalConfiguration >

</deployment>

>
> Ok found a solution for this one....needed to pass a String for the 
> PWCallback class, not the class itself.
>
>> 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: wss4j-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Michael Rudolf <mi...@t-online.de>.
I still have a problem with this type of invocation. Now i get the 
following exception:


AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
 faultSubcode:
 faultString: Did not understand &quot;MustUnderstand&quot; header(s):
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}stackTrace:
    at 
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    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 
al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
    at JobStatus.main(JobStatus.java:35)

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

Did not understand "MustUnderstand" header(s):
    at 
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    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 
al.JCT.service.JCTSoapBindingStub.getJobStatus(JCTSoapBindingStub.java:316)
    at JobStatus.main(JobStatus.java:35)



This is my WSDD file. When i use this to configure Axis everything works 
fine.
Thanks for any help!
Michael


<deployment xmlns="http://xml.apache.org/axis/wsdd/" 
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 <transport name="http" 
pivot="java:org.apache.axis.transport.http.HTTPSender"/>

  <globalConfiguration >

   <requestFlow >

    <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >

     <parameter name="action" value="UsernameToken"/>

     <parameter name="passwordCallbackClass" value="PWCallback"/>

    </handler>

   </requestFlow >

  </globalConfiguration >

</deployment>

>
> Ok found a solution for this one....needed to pass a String for the 
> PWCallback class, not the class itself.
>
>> 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: wss4j-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Michael Rudolf <mi...@t-online.de>.
Ok found a solution for this one....needed to pass a String for the 
PWCallback class, not the class itself.

> 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: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: ClassCast exception with PW callback class

Posted by Michael Rudolf <mi...@t-online.de>.
Ok found a solution for this one....needed to pass a String for the 
PWCallback class, not the class itself.

> 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: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org