This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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?
 
It's never done THAT before. Explain it to me tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic