Example of setting client side handler?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Example of setting client side handler?

Vjeran Marcinko
Hi.

I think that answer to my question - how to set attacments before calling
some action on WSLD2Java-gnerated stub, can lie in client handlers, but
unfortunately, documentation isn't still available :
http://ws.apache.org/axis/java/client-side-axis.html#ConfiguringClient-sideHandlers

So, can someone give me some example ?

-Vjeran



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 4.5.2005

Reply | Threaded
Open this post in threaded view
|

Re: Example of setting client side handler?

Dan O'Neill
Is this question about using client side handlers or using them to add
attachments to outgoing soap messages? Well if its the former look
below, if its the latter, I cant remember the code for adding
attachments straight of the top of my head though there a few examples
on the web...

Client side handlers can only be invoked through code... or thats what
seems to be the consenus here...

In java first you have to create an object of your handler. So if your
request handler is called loghandler then:

loghandler log = new loghandler();

Then if your using Dynamic invocation its just call.setclientHandlers(log,null)

Its similar for response handlers too.

Sorry if this has no bearing on your project... Just hope to point you
in the right direction....

Dan


On 5/9/05, Vjeran Marcinko <[hidden email]> wrote:

> Hi.
>
> I think that answer to my question - how to set attacments before calling
> some action on WSLD2Java-gnerated stub, can lie in client handlers, but
> unfortunately, documentation isn't still available :
> http://ws.apache.org/axis/java/client-side-axis.html#ConfiguringClient-sideHandlers
>
> So, can someone give me some example ?
>
> -Vjeran
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 4.5.2005
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Example of setting client side handler?

Vjeran Marcinko
Thanx Dan, though it doesn't help me.
I really need a way to set attachments, or sername and password, but *when
using generated classes from WSLD*. There are many examples around, but only
for low level usage with Call objects, but I don't see a way to fetch Call
instance at all when working with generated classes. Here's an example:

FooServiceLocator fooServiceLocator = new FooServiceLocator();
FooPort fooPort = fooServiceLocator.getFooPort(...url...);
fooPort.doSomeAction();

How can I get Call instance for this call above?

-Vjeran

----- Original Message -----
From: "Dan O'Neill" <[hidden email]>
To: <[hidden email]>
Sent: Monday, May 09, 2005 1:20 PM
Subject: Re: Example of setting client side handler?


Is this question about using client side handlers or using them to add
attachments to outgoing soap messages? Well if its the former look
below, if its the latter, I cant remember the code for adding
attachments straight of the top of my head though there a few examples
on the web...

Client side handlers can only be invoked through code... or thats what
seems to be the consenus here...

In java first you have to create an object of your handler. So if your
request handler is called loghandler then:

loghandler log = new loghandler();

Then if your using Dynamic invocation its just
call.setclientHandlers(log,null)

Its similar for response handlers too.

Sorry if this has no bearing on your project... Just hope to point you
in the right direction....

Dan


On 5/9/05, Vjeran Marcinko <[hidden email]> wrote:
> Hi.
>
> I think that answer to my question - how to set attacments before calling
> some action on WSLD2Java-gnerated stub, can lie in client handlers, but
> unfortunately, documentation isn't still available :
>
http://ws.apache.org/axis/java/client-side-axis.html#ConfiguringClient-sideHandlers

>
> So, can someone give me some example ?
>
> -Vjeran
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 4.5.2005
>
>



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 4.5.2005

Reply | Threaded
Open this post in threaded view
|

Re: Example of setting client side handler?

Tom Ziemer
Hi,

I'm not sure I understand you correctly - do you want to access the the
call using an ant-generated stub? If that's the case, you can try this:

FooServiceLocator fooServiceLocator = new FooServiceLocator();
FooServiceSoapBindingStub fooServiceStub = null;
try
{
        fooServiceStub = (FooServiceSoapBindingStub)
fooServiceLocator.getFooService();
        // getting the call:
        Call call = fooServiceStub._getCall();
        // username
        fooServiceStub.setUserName("Dunno");
...
}
...

Hope this helps,

Regards,
Tom



Vjeran Marcinko wrote:

> Thanx Dan, though it doesn't help me.
> I really need a way to set attachments, or sername and password, but *when
> using generated classes from WSLD*. There are many examples around, but only
> for low level usage with Call objects, but I don't see a way to fetch Call
> instance at all when working with generated classes. Here's an example:
>
> FooServiceLocator fooServiceLocator = new FooServiceLocator();
> FooPort fooPort = fooServiceLocator.getFooPort(...url...);
> fooPort.doSomeAction();
>
> How can I get Call instance for this call above?
>
> -Vjeran
>
> ----- Original Message -----
> From: "Dan O'Neill" <[hidden email]>
> To: <[hidden email]>
> Sent: Monday, May 09, 2005 1:20 PM
> Subject: Re: Example of setting client side handler?
>
>
> Is this question about using client side handlers or using them to add
> attachments to outgoing soap messages? Well if its the former look
> below, if its the latter, I cant remember the code for adding
> attachments straight of the top of my head though there a few examples
> on the web...
>
> Client side handlers can only be invoked through code... or thats what
> seems to be the consenus here...
>
> In java first you have to create an object of your handler. So if your
> request handler is called loghandler then:
>
> loghandler log = new loghandler();
>
> Then if your using Dynamic invocation its just
> call.setclientHandlers(log,null)
>
> Its similar for response handlers too.
>
> Sorry if this has no bearing on your project... Just hope to point you
> in the right direction....
>
> Dan
>
>
> On 5/9/05, Vjeran Marcinko <[hidden email]> wrote:
>
>>Hi.
>>
>>I think that answer to my question - how to set attacments before calling
>>some action on WSLD2Java-gnerated stub, can lie in client handlers, but
>>unfortunately, documentation isn't still available :
>>
>
> http://ws.apache.org/axis/java/client-side-axis.html#ConfiguringClient-sideHandlers
>
>>So, can someone give me some example ?
>>
>>-Vjeran
>>
>>--
>>No virus found in this outgoing message.
>>Checked by AVG Anti-Virus.
>>Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 4.5.2005
>>
>>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Example of setting client side handler?

Vjeran Marcinko
Hi Tom.

I hope you could answer this since I'm so tired of searching the web for
answer (I've been doing it for days now), although I find it very strange
because I need very common stuff, and strangely nobody gave me suitable
answer...

Client stubs in general are singletons, meaning, I don't instantiate new one
during each call, but all simultaneous client threads can use it
concurrently. Meaning, client stubs are thread-safe, and all client see is
just stub's service interface.

Meaning, following piece of code (stub instantiation) is usually executed
during *container startup* :
FooServiceLocator fooServiceLocator = new FooServiceLocator();
FooPort fooPort = fooServiceLocator.getFooPort(...url...);

...and later, all threads just access this single instance "fooPort"
concurrently whenever they need to perform remote action in a form:
fooPort.doSomeAction();

But, since every simultaneous call to this action can contain different
attachments/usernames/passwords, I would need something like:
fooPort.doSomeAction(attachments, username, password);

But, since it would be changing of service interface, which is not possible,
there has to be some concurrent way to achieve this (usually it's some
ThreadLocal way when one needs to pass context values not described by
method signature).

My question is - since all these values (attachments, username...) can be
set on Call instance, if I fetch this Call by :
Call call = ((Stub)fooPort).getCall();
call.setAttachments(attachments)
before I call :
fooPort.doSomeAction();

is this gonna be OK ? If concurrent thread fetches the same Call instance
that it's all no good.

-Vjeran

----- Original Message -----
From: "Tom Ziemer" <[hidden email]>
To: <[hidden email]>
Sent: Monday, May 09, 2005 3:02 PM
Subject: Re: Example of setting client side handler?


> Hi,
>
> I'm not sure I understand you correctly - do you want to access the the
> call using an ant-generated stub? If that's the case, you can try this:
>
> FooServiceLocator fooServiceLocator = new FooServiceLocator();
> FooServiceSoapBindingStub fooServiceStub = null;
> try
> {
> fooServiceStub = (FooServiceSoapBindingStub)
> fooServiceLocator.getFooService();
> // getting the call:
> Call call = fooServiceStub._getCall();
> // username
> fooServiceStub.setUserName("Dunno");
> ...
> }
> ...
>
> Hope this helps,
>
> Regards,
> Tom
>
>



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 4.5.2005

Reply | Threaded
Open this post in threaded view
|

Re: Example of setting client side handler?

Tom Ziemer
Hi Vjeran,

I'm sorry but I cannot really help you. I *think* it should work, though
you might have to create new calls in your threads before invoking the
service. Couldn't you just write some test cases to figure out, whether
or not you get the same call instance?

Sorry - I know that wasn't very helpful,

Regards,
Tom

Vjeran Marcinko wrote:

> Hi Tom.
>
> I hope you could answer this since I'm so tired of searching the web for
> answer (I've been doing it for days now), although I find it very strange
> because I need very common stuff, and strangely nobody gave me suitable
> answer...
>
> Client stubs in general are singletons, meaning, I don't instantiate new one
> during each call, but all simultaneous client threads can use it
> concurrently. Meaning, client stubs are thread-safe, and all client see is
> just stub's service interface.
>
> Meaning, following piece of code (stub instantiation) is usually executed
> during *container startup* :
> FooServiceLocator fooServiceLocator = new FooServiceLocator();
> FooPort fooPort = fooServiceLocator.getFooPort(...url...);
>
> ...and later, all threads just access this single instance "fooPort"
> concurrently whenever they need to perform remote action in a form:
> fooPort.doSomeAction();
>
> But, since every simultaneous call to this action can contain different
> attachments/usernames/passwords, I would need something like:
> fooPort.doSomeAction(attachments, username, password);
>
> But, since it would be changing of service interface, which is not possible,
> there has to be some concurrent way to achieve this (usually it's some
> ThreadLocal way when one needs to pass context values not described by
> method signature).
>
> My question is - since all these values (attachments, username...) can be
> set on Call instance, if I fetch this Call by :
> Call call = ((Stub)fooPort).getCall();
> call.setAttachments(attachments)
> before I call :
> fooPort.doSomeAction();
>
> is this gonna be OK ? If concurrent thread fetches the same Call instance
> that it's all no good.
>
> -Vjeran
>
> ----- Original Message -----
> From: "Tom Ziemer" <[hidden email]>
> To: <[hidden email]>
> Sent: Monday, May 09, 2005 3:02 PM
> Subject: Re: Example of setting client side handler?
>
>
>
>>Hi,
>>
>>I'm not sure I understand you correctly - do you want to access the the
>>call using an ant-generated stub? If that's the case, you can try this:
>>
>>FooServiceLocator fooServiceLocator = new FooServiceLocator();
>>FooServiceSoapBindingStub fooServiceStub = null;
>>try
>>{
>>fooServiceStub = (FooServiceSoapBindingStub)
>>fooServiceLocator.getFooService();
>>// getting the call:
>>Call call = fooServiceStub._getCall();
>>// username
>>fooServiceStub.setUserName("Dunno");
>>...
>>}
>>...
>>
>>Hope this helps,
>>
>>Regards,
>>Tom
>>
>>
>
>
>
>