why WSPasswordCallback.getPassword is null when I try my soap request
Tania Marinova <[email protected]>
| Newsgroups | gmane.text.xml.axis.user |
|---|---|
| Message-ID | <[email protected]> |
i
I have made axis 2 web service with rampart security
but I constantly was receiving null point exception at this line
if((pwcb.getIdentifier().equals("bob")) && pwcb.getPassword().equals("bobPW")) )
so when I wrote this code
if ( pwcb.getPassword()==null)
{ throw new Exception ("passsssssssss is null:"+pwcb.getPassword());
I saw at last that the problem is that pwcb.getPassword is null and I can't explain why
Thank you in advance
this is my soaprequest
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soapenv:Envelope " + "xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " + "xmlns:nilo=\"http://nilo\">"+ "<soapenv:Header>"+ '<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" soapenv:mustUnderstand="1">'+ '<wsse:UsernameToken xmlns:wsu="http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="123">'+ '<wsse:Username>bob</wsse:Username>'+ '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">bobPW</wsse:Password>'+ '</wsse:UsernameToken>'+ '</wsse:Security>'+ "</soapenv:Header>"+ "<soapenv:Body>" + "<nilo:getdataForChecking>" + '<nilo:data>'+tranXml+'</nilo:data>' + ' </nilo:getdataForChecking>'+ '</soapenv:Body>' + '</soapenv:Envelope>';
My PWCBHandler.java class
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) { //When the server side need to authenticate the user WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; if ( pwcb.getPassword()==null) { try { throw new Exception ("passsssssssss null:"+pwcb.getPassword()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { throw new Exception ("pass nooot null:"+pwcb.getPassword()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(pwcb.getIdentifier().equals("bob") && pwcb.getPassword().equals("bobPW")) { return; }