This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Security and the fly likes WS-Security :How to send a SOAP message back to client on authentication error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "WS-Security :How to send a SOAP message back to client on authentication error" Watch "WS-Security :How to send a SOAP message back to client on authentication error" New topic
Author

WS-Security :How to send a SOAP message back to client on authentication error

priya verma
Greenhorn

Joined: May 09, 2007
Posts: 13
I am using ws-security to protect my web service. I have implemented a passwordCallbackClass at the server for the protected web service as shown below . Before going to MyWebService , controls goes to passwordCallbackClass. Here I check the username and password sent by the client. If the user is invalid I want to send a response back to client in the form of SOAP message. Can anyone please help me in this...

<service name="MyWebService" provider="java:MSG">
<requestFlow>
<handler type="javarg.apache.ws.axis.security.WSDoAllReceiver">
<parameter name="passwordCallbackClass" value="PWCallback"/>
<parameter name="action" value="UsernameToken"/>
</handler>
</requestFlow>

Any help will be greatly appreciated!!!

Thanks
Priya
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41085
    
  43
Generally, the Callbackhandler.handle method throw an IOException for any authentication failure, which will then be reported as a SOAPFault back to the client. You can pass a string with more information as a part of the exception, but I don't think you have much control over the SOAPFault in general. What exactly are you trying to accomplish?


Ping & DNS - my free Android networking tools app
priya verma
Greenhorn

Joined: May 09, 2007
Posts: 13
Hi Ulf,

Thanks for the reply!

In case of authentication failure, I dont want to send a soapfault to client. Instead, I want to send an XML response to the client.This XML will contain the error.

Web service CLient code:

try{

1. Vector response = (Vector) call.invoke(input);
2. SOAPBodyElement elem = (SOAPBodyElement) response.get(0);
} catch (AxisFault af) {

Here, intead of getting the authentication error as AxisFault , I need to get the response in SOAPBodyElement at line 2.
Is there any way I can do this?
 
 
subject: WS-Security :How to send a SOAP message back to client on authentication error
 
Similar Threads
WSS4j UserToken action handler for many users
Custom Authentication in Axis1.4
problem in configure wss4j in axis 1.4 with JBoss application server
WSE security authentication problem.
WSS4J problem in Axis