• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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="java:org.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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
priya verma
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 am displeased. You are no longer allowed to read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic