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 Vjeran Marcinko <vj...@tis.hr> on 2004/12/07 09:03:44 UTC

User credentials and Axis generated stub

Hi folks.

I asked similar question some time ago, but I think I didn't explain clearly
what I need, thus answer was unsuitable I think. So here I go again.
Let's say for example that Axis generated client stub classes for remote web
service by name MyAdder, thus central  interface is MyAdderPort :

public interface MyAdderPort {
    public int add(int a, int b);
}

I now have in my client application singleton layer for executing remote
calls to this web service, and since this is singleton used by many
different users simultaneously, there are user credentials passed as method
arguments :

public class WebServiceLayer {
    private MyAdderPort myAdderPort = ....; // instantiate somehow

    public int executeAdd(int a, int b, String username, String password) {
        // fist we have to inject username/password into call
        ....
        // execute call
        return myAdderPort.add(a, b);
    }
}

Question is - How can I inject these username/password into remote call ? Or
maybe it's impossible, thus I'll have to instantate client stub during each
method call :

public class WebServiceLayer {

    public int executeAdd(int a, int b, String username, String password) {
        MyAdderPort myAdderPort = ....; // instantiate somehow....
        ((Stub) myAdderPort).setUsername(username);
        ((Stub) myAdderPort).setPassword(password);

        // execute call
        return myAdderPort.add(a, b);
    }
}

Of course, first case is more desirable, but I cannot see the way to inject
user credentials.
Some solution ?

Thanx,
Vjeran




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 5.12.2004