File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 39547
    
  27
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 - updated with new look and Ping home screen widget
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WS-Security :How to send a SOAP message back to client on authentication error
 
Similar Threads
WSS4j UserToken action handler for many users
WSE security authentication problem.
Custom Authentication in Axis1.4
problem in configure wss4j in axis 1.4 with JBoss application server
WSS4J problem in Axis