You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Herman D'costa <hd...@digev.com> on 2003/10/07 05:43:55 UTC

RE: getUsername

Hello anybody there,
 
I had a question earlier (see email below), and got no reply.
 
This question relates to the onFault method of BasicHandler. I wrote a handler by extending org.apache.axis.handlers.BasicHandler, and overrid the onFault method. I saw that onFault is called and correctly when the handler is configured for the specific service (in server-config.wsdd). However, if I configure the handler in the GlobalConfiguration section or in the HTTP transport section, it doesn't get called, when there is an error in the web service request-response flow. 
 
Please may I know why?
 
Thanks, regds
Herman D'Costa
 

-----Original Message-----
From: Herman D'costa 
Sent: Monday, September 22, 2003 4:34 PM
To: axis-dev@ws.apache.org
Subject: getUsername



Hello 

I am writing axis request and response handlers for a web service application. If I want the real username of the user of the request, how do I get it? Should I get it from the Message Context, thru a call to msgContext.getUsername or should I retrieve the Servlet Request object and get its remote user? How does the msg context get the user name from?

Any pointers to documentation with related information, for related questions that might come up, will be greatly appreciated.

Thanks, regds 
Herman D'Costa 


Re: getUsername

Posted by Stephen Gordon <st...@student.usyd.edu.au>.
I am doing some authentication in Axis.
To get the username, you can indeed use MessageContext.getUsername()

To set the username do the following:

com.blah.ExampleService s = new com.blah.ExampleServiceLocator();
com.blah.Example e = s.getexample();
((javax.xml.rpc.Stub)e)._setProperty(javax.xml.rpc.Call.USERNAME_PROPERTY, 
"username");

in the client.
If there is a better way to set the username someone please speak up!!

I hate to say it, but the onFault problem you are experiencing sounds 
like a mis-configuration or coding error on your part. After all the 
request/response flow is a fairly important part of axis so i would be 
surprised if there was still a bug of this simple nature in it. If you 
like you can send me the handler in question and I can try to reproduce 
the bug.

stephen

Herman D'costa wrote:

> Hello anybody there,
>  
> I had a question earlier (see email below), and got no reply.
>  
> This question relates to the onFault method of BasicHandler. I wrote a 
> handler by extending org.apache.axis.handlers.BasicHandler, and overrid 
> the onFault method. I saw that onFault is called and correctly when the 
> handler is configured for the specific service (in server-config.wsdd). 
> However, if I configure the handler in the GlobalConfiguration section 
> or in the HTTP transport section, it doesn't get called, when there is 
> an error in the web service request-response flow.
>  
> Please may I know why?
>  
> Thanks, regds
> Herman D'Costa
>  
> 
>     -----Original Message-----
>     *From:* Herman D'costa
>     *Sent:* Monday, September 22, 2003 4:34 PM
>     *To:* axis-dev@ws.apache.org
>     *Subject:* getUsername
> 
>     Hello
> 
>     I am writing axis request and response handlers for a web service
>     application. If I want the real username of the user of the request,
>     how do I get it? Should I get it from the Message Context, thru a
>     call to msgContext.getUsername or should I retrieve the Servlet
>     Request object and get its remote user? How does the msg context get
>     the user name from?
> 
>     Any pointers to documentation with related information, for related
>     questions that might come up, will be greatly appreciated.
> 
>     Thanks, regds
>     Herman D'Costa
>