You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jack Xue <jx...@regenstrief.org> on 2003/05/12 16:17:34 UTC

How to catch username and password on WebserviceSoapImpl code?

Hi,

Does someone know how to catch the username and password I set in my
client class by casting them into the stub class as Sasha pointed out?
Thanks.

Yours Jack

On Mon, 2003-05-12 at 08:30, Jack Xue wrote:
> 
> [prev in list] [next in list] [prev in thread] [next in thread] 
> 
> List:     axis-user
> Subject:  Re: Username/Password for WSDL generated code...
> From:     Sasha Lerner <alerner () grandcentral ! com>
> Date:     2002-10-18 22:27:22
> [Download message RAW]
> 
> 
> --Apple-Mail-43-838267966
> Content-Transfer-Encoding: quoted-printable
> Content-Type: text/plain;
> 	charset=ISO-8859-1;
> 	format=flowed
> 
> no elegant way without accessing Stub that I know of, or inserting it 
> into generated stub
> but you can cast it to DownloadServiceBindingStub so all it adds is 
> just one import
> i dont think this is too bad:
> 
> DownloadServiceLocator  locator = new DownloadServiceLocator();
> DownloadService binding  = locator. getDownload();
> 
> ((DownloadServiceBindingStub) binding).setUsername("foo");
> ((DownloadServiceBindingStub) binding).setPassword("bar");
> 
> binding.methodcall(...)
> 
> 
> On Friday, October 18, 2002, at 02:32 PM, Jesper Söderlund wrote:
> 
> > How do I set username/password for a WSDL-generated class.
> >  
> > In my case the DownloadServiceLocator has a "getDownload()" method for
> > returning a proxy to call the service (examples strongly simplified).
> >  
> > class DownloadServiceLocator {
> >     DownloadServiceBindingStub member;
> >     DownloadService getDownload(URL u) { ... return member;}
> >     ...
> > }
> >  
> > But the problem is that the implementation returns the 
> > "DownloadService" interface that defines the service operations (which
> > is implemented by the Stub subclass.
> >  
> > class DownloadServiceBindingStub extends Stub implements 
> > DownloadService {
> >    // DownloadService methods
> > }
> >  
> > The problem now is that to set the username/password I have to access 
> > the Stub sub-class which breakes the nice encapsulation of working 
> > with a DownloadService. Sure I can cast it back to a Stub but that's 
> > not very elegant, there must be a simple / better solution.
> >  
> > In the JAX-RPC specification there are two different examples (chapter
> > 13.1.1), either you provide it as "getDownload(URL u, String user, 
> > String password)" or your provide a way to get at the stub (and now I 
> > don't think that casting is an elegant solution).
> >  
> > Yet another solution would be to expose the "get/setProperty" items in
> > the (DownloadService)Locator class.
> 
> --Apple-Mail-43-838267966
> Content-Transfer-Encoding: quoted-printable
> Content-Type: text/enriched;
> 	charset=ISO-8859-1
> 
> no elegant way without accessing Stub that I know of, or inserting it
> into generated stub
> 
> but you can cast it to DownloadServiceBindingStub so all it adds is
> just one import
> 
> i dont think this is too bad:
> 
> 
> DownloadServiceLocator  locator = new DownloadServiceLocator();
> 
> DownloadService binding  = locator. getDownload();
> 
> 
> ((DownloadServiceBindingStub) binding).setUsername("foo");
> 
> ((DownloadServiceBindingStub) binding).setPassword("bar");
> 
> 
> binding.methodcall(...)
> 
> 
> 
> On Friday, October 18, 2002, at 02:32 PM, Jesper Söderlund wrote:
> 
> 
> <excerpt>How do I set username/password for a WSDL-generated class.
> 
>  
> 
> In my case the DownloadServiceLocator has a "getDownload()" method for
> returning a proxy to call the service (examples strongly simplified).
> 
>  
> 
> class DownloadServiceLocator {
> 
>     DownloadServiceBindingStub member;
> 
>     DownloadService getDownload(URL u) { ... return member;}
> 
>     ...
> 
> }
> 
>  
> 
> But the problem is that the implementation returns the
> "DownloadService" interface that defines the service operations (which
> is implemented by the Stub subclass.
> 
>  
> 
> class DownloadServiceBindingStub extends Stub implements
> DownloadService {
> 
>    // DownloadService methods
> 
> }
> 
>  
> 
> The problem now is that to set the username/password I have to access
> the Stub sub-class which breakes the nice encapsulation of working
> with a DownloadService. Sure I can cast it back to a Stub but that's
> not very elegant, there must be a simple / better solution.
> 
>  
> 
> In the JAX-RPC specification there are two different examples (chapter
> 13.1.1), either you provide it as "getDownload(URL u, String user,
> String password)" or your provide a way to get at the stub (and now I
> don't think that casting is an elegant solution).
> 
>  
> 
> Yet another solution would be to expose the "get/setProperty" items in
> the (DownloadService)Locator class.
> 
> </excerpt>
> --Apple-Mail-43-838267966--
> 
>