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 yx...@wm.edu on 2002/08/07 18:28:27 UTC

Session: simpleSessionHandler

Hello,

I am trying to use simpleSessionHandler in my project.
And  it does not work. I don't know what is wrong and
please help me.

I did the following:
1. deploy the service as scope = session
2. add simplesession handler in requestFlow and
responseFlow for this service.
3. deploy it by using java
org.apache.axis.client.AdminClient deploy.wsdd
4. set session to true in client side:
binding.setMaintainSession(true)

result: every time I call a function in this service,
the response soap message header has an incresed
sessionId. And the service acts as a response/request
service. Session infomation was not maintained.

I don't know what is wrong with it. And hope somebody
could give me some suggestions and if you could give me
an example of it, I will appreciate it a lot.

I could use http header cookies to make it work, but I
want to make it work by using soap header message. 

All my code is based on wsdl2java, so if you could show
me where I should make change in soapbindingStub or
soapbindingSkeleton, that will be great. I read all the
discussion on session and the simplesession test.java,
but still could not figure it out, Please help!

Lots of thanks!

Tina

Re: Session: simpleSessionHandler And Ansynchronized messaging

Posted by yx...@wm.edu.
Hello Tom, 

Thanks for your help, I got it all worked out. The
authorization header is  to inform the client side
authorization granted and time out information for the
subsequent calls to server. 

By the way, does anyone know how to enforce the
services' (calls) order on the server side, if there are
many methods (calls) avaliable in the web service. 

Another question is how to inform the client the server
has timed out. Right now I am using soap header message
to construct the time out information on the server side
and process it in the client side. Does anyone has a
better idea? Or know how to inform the client in an
Asynchronized way from the server side?

Thanks in advance!

Tina  

Re: Session: simpleSessionHandler

Posted by Tom Braun <Th...@hp.com>.
On Wednesday 14 August 2002 18:38, yxlix1@wm.edu wrote:
> I have one more question. When I put/declare the handler
> inside the service, it does not work. But axis says that
> you could define the handler inside a service, or
> global, or in the transport.

are you talking about the client or the server .wsdd?
on the client side there is no <service> entry allowed, thus defining a 
handler herein won't work.
on the server-side however it should (it works in my apps).
 
did you enclose the handler definition in a <requestFlow> or <responseFlow> ?
maybe you could post the .wsdd here?

> And even now, I could not get the messageContext object
> in the client side. when I using the following code
> before the call.invoke() and after it, the msgC is null.

i'm not at all sure here but: 
maybe you could use call.getMessageContext() instead.

>                  }
>                     else {
>                         System.out.println("the
> authorization header is null");
>                     }
>                 } catch (Exception e) {

what are you trying to do? 
i may be wrong but i can't think of authorization headers making sense on the 
client-side.

hope this helped you,

tom

Re: Session: simpleSessionHandler

Posted by yx...@wm.edu.
Hello, Tom,

Thanks for all your help. It works now. The session id
is consistant and I could set the session property in
one call and get it in the following calls in the server
side. 

I have one more question. When I put/declare the handler
inside the service, it does not work. But axis says that
you could define the handler inside a service, or
global, or in the transport. 

And even now, I could not get the messageContext object
in the client side. when I using the following code
before the call.invoke() and after it, the msgC is null.

MessageContext msgC = MessageContext.getCurrentContext();
         System.out.println("get messagecontext before
call invoke\n\n");
            if (msgC != null) {
                System.out.println("messagecontext is
not null");
                Message requestMessage =
msgC.getRequestMessage();
                Message responseMessage =
msgC.getResponseMessage();  
                 }
                    else {
                        System.out.println("the
authorization header is null");
                    }
                } catch (Exception e) {
                    new
org.apache.axis.AxisFault("Failure trying to get the
Message object", e);
                }
            }

Do you have any insight on that, or I am doing something
wrong?

Thanks again, and I am really happy about the session
handler now.

Tina

Quoting Tom Braun <Th...@hp.com>:

> > But I don't know where should I put the
> generated
> > clinet-config.wsdd to let client or axis
> engine know the
> > client want the session info.
> 
> the easiest way is to put the file in the
> directory (or .jar) where your 
> client's .class files reside. for a servelt this
> will be WEB-INF/classes.
> having a stand-alone client, you may specify the
> classpath when
> starting the prog like:
> 
> java -cp path-to-client-conf:path-to-class-files
>     class-containing-main
> 
> or you could set the CLASSPATH environment
> variable befor starting the client.
> 
> tom
> 

Re: Session: simpleSessionHandler

Posted by Tom Braun <Th...@hp.com>.
> But I don't know where should I put the generated
> clinet-config.wsdd to let client or axis engine know the
> client want the session info.

the easiest way is to put the file in the directory (or .jar) where your 
client's .class files reside. for a servelt this will be WEB-INF/classes.
having a stand-alone client, you may specify the classpath when
starting the prog like:

java -cp path-to-client-conf:path-to-class-files     class-containing-main

or you could set the CLASSPATH environment variable befor starting the client.

tom

Re: Session: simpleSessionHandler

Posted by yx...@wm.edu.
hello, Tom,

Thanks for your help. I noticed that I need the file
client-config.wsdd and it may generate by using 
java org.apache.axis.utils.Admin client deploy.wsdd

But I don't know where should I put the generated
clinet-config.wsdd to let client or axis engine know the  
client want the session info. 

Maybe this sound silly, but could you please tell me
where to set the classpath for client or where should I
put that file.

Thanks a lot!

Ying 


Quoting Tom Braun <Th...@hp.com>:

> hi tina,
> you have to insert the the SimpleSessionHandler
> in the client's request and 
> response flows as well.
> this is done by putting a file named
> client-config.wsdd in the client's 
> classpath.
> here is an example:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <deployment name="defaultClientConfig"
>                   
> xmlns="http://xml.apache.org/axis/wsdd/"
>            
>
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
>                                
> xmlns:ns1="urn:SurveyApp">
>   <transport name="http"
>                 
> pivot="java:org.apache.axis.transport.http.HTTPSender">
>     <requestFlow>
>        <handler
>
type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
>     </requestFlow>
> 
>     <responseFlow>
>        <handler
>
type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
>      </responseFlow>
>   </transport>
> </deployment>
> 
> 

Why doesn't deploy except on non-existent classes?

Posted by Colin Sampaleanu <co...@exis.com>.
I find it somewhat annoying (in that it leads to finding out about 
problems later rather than sooner) that calling AdminClient to perform a 
deployment will not throw an error if the class to deploy (as specified 
with the "className" parameter) doesn't actually exist. Instead, you get 
an error when you actually try to call the service.

I suppose I can see the case where it is useful to defer validation 
until actual use, but I think for most users it would be better to 
provide feedback at deployment time that the specified classes do not exist.

I am using Axis from CVS, 2002-8-7. Am I missing something?



Re: Session: simpleSessionHandler

Posted by Tom Braun <Th...@hp.com>.
hi tina,
you have to insert the the SimpleSessionHandler in the client's request and 
response flows as well.
this is done by putting a file named client-config.wsdd in the client's 
classpath.
here is an example:

<?xml version="1.0" encoding="UTF-8"?>
<deployment name="defaultClientConfig"
                   xmlns="http://xml.apache.org/axis/wsdd/"
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
                                xmlns:ns1="urn:SurveyApp">
  <transport name="http"
                 pivot="java:org.apache.axis.transport.http.HTTPSender">
    <requestFlow>
       <handler type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
    </requestFlow>

    <responseFlow>
       <handler type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
     </responseFlow>
  </transport>
</deployment>


Basic XML Question

Posted by Anthony Smith <an...@fedex.com>.
How do I pass just an xml page to another server?
I only need to pass this page to a server when a user clicks a link. The
identified user's profile will be what is mainly composed of the XML.