I tried your code (insted of System.out.println I throw an exception )
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException
{
for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
if (pwcb.getUsage()==0)
{
try {
throw new Exception("Usage is 0");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
{
try {
throw new Exception("Usage is: " +pwcb.getUsage() );
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (pwcb.getIdentifier()==null)
{
pwcb.setPassword("bobPW");
}
else
{
try {
throw new Exception ("found id, could be used to get
stored passwod" + pwcb.getIdentifier());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
And here is the response
java.lang.Exception: Usage is: 2
at nilo.PWCBHandler.handle(PWCBHandler.java:77)
-----------------------------------------------------------------------------------------
java.lang.Exception: found id, could be used to get stored passwod: bobWWW
at nilo.PWCBHandler.handle(PWCBHandler.java:97)
at
org.apache.rampart.TokenCallbackHandler.handle(TokenCallbackHandler.java:98)
a------------------------------------------------------------------------------------
So usage is : 2 and of course it extract the identifier correctly
________________________________
From: robert lazarski <[email protected]>
To: [email protected]; Tania Marinova <[email protected]>
Sent: Thursday, May 9, 2013 4:58 PM
Subject: Re: why WSPasswordCallback.getPassword is null when I try my soap
request
On Thu, May 9, 2013 at 8:36 AM, Tania Marinova <[email protected]> wrote:
>
> Thank you for the help robert but I really think there is something wrong
> here and I can't find no documentation and nobody can answer me!
That's why you need to run the code I asked you to - I need the debug
info to find the problem in your env. The "usage" param value, as
described in the link you pasted, explains 4 use cases and a few of
those pass a null password. I suggest you read the docs again, seems
you missed some important details.
- R
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]