Hi Chris,
I was doing it something like this now,
if(session == null) {
log.info("session does not exist");
throw new AxisFault("Server.noSession",
"Session does not
exist",null,null);
}
else
if(!"true".equals((String)session.get("validUser"))) {
log.info("user is not valid");
throw new AxisFault("Server.invalidUser",
"User is not valid",null,null);
}
This code I have written in a request handler and then I have another
handler one level down and as soon as
this exception arises, in the onFault method of handler, I am trying to
modify the SOAP message. I am removing the SOAPBody and then trying to
construct with my message again. But I am failing here because of my lack of
knowledge.
Do you think this is the correct approach?
my onFault method looks something like:
SOAPEnvelope env = MessageContext.getSOAPEnvelope();
//clear the body
env.getBody().detachNode();
//create new body element
env.addBody();
javax.xml.soap.Name name =
env.createName("testSecurityResponse","bla","http://soap.bla.com");
env.addBodyElement(new
org.apache.axis.message.SOAPBodyElement(name));
I am not really sure how to add the attributes to this. Can anyone correct
if I am doing something wrong here.
Thanks
kiran pathuru
-----Original Message-----
From: Chris Haddad [mailto:[EMAIL PROTECTED]
Sent: Monday, March 22, 2004 10:46 PM
To: [EMAIL PROTECTED]
Subject: Re: session, handler problem
Kiran -
have you considered embedding the custom message inside the SOAP fault as a
detail element or as a custom exception?
/Chris
---------- Original Message ----------------------------------
From: "Pathuru, Kiran" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date: Mon, 22 Mar 2004 15:10:03 +0100
>I have a webservice which works based on sessions. The user first need to
>login and then onwards can make the calls.
>
>In one of my request handlers, now I am checking what method the user is
>requesting and then see whether
>the user has already logged in successfully, otherwise I will raise an Axis
>Fault. But my client don't like
>this and he want to see a returnMessage like login failed or session
>expired. Can anyone suggest me how can I do this?
>
>Is there anyway that I can construct a SOAP message in my request handler
>and send it back to the caller instead of forwarding it to the service? I
>think I can solve my problem in this way but don't know how to do it. Any
>help will be appreciated.
>
>Thanks in Advance,
>kiran pathuru
>