You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Gunnar Osterode <gu...@gemplus.com> on 2002/02/01 15:49:03 UTC

SOAP-RPC and stateful session EJB

I'm using SOAP-RPC and send multiple requests within on HTTPSession. I've 
deployed a StatefulSessionBean with the scope "Session". At the client side 
I use the same Call object for all requests and I guess the HTTPSession is 
maintained ( the "Set-Cookie" HTTP header field including the JSESSIONID 
only comes with the first response). Nevertheless for every request a new 
instance of the SessionBean is created.

Any suggestion would be great.

Best regards,
Gunnar 


Re: SOAP-RPC and stateful session EJB

Posted by Elaine Chien <el...@sun.com>.
You may be hitting the cookie header bug.  The problem is that a case sensitive
search of set-cookie header is used. So if the web server you are using does
not set the cookie header name as "Set-Cookie", the cookie header won't get
picked up. See below for the patch request that Warwick Slade submitted.

[Attachment #2 (multipart/alternative)]

Patch to perform a case insensitive search on http header.

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.3315.2870" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Patch to perform a case insensitive search on
http
header.</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

["patchfile.txt" (text/plain)]

5c5
<  * Copyright (c) 2000 The Apache Software Foundation.  All rights
---
>  * Copyright (c) 2000 The Apache Software Foundation.  All rights
13c13
<  *    notice, this list of conditions and the following disclaimer.
---
>  *    notice, this list of conditions and the following disclaimer.
21c21
<  *    if any, must include the following acknowledgment:
---
>  *    if any, must include the following acknowledgment:
29c29
<  *    software without prior written permission. For written
---
>  *    software without prior written permission. For written
266c266
<         }
---
>         }
272c272
<       headers.put (Constants.HEADER_SOAP_ACTION,
---
>       headers.put (Constants.HEADER_SOAP_ACTION,
311,312c311
<         // leave the current
<         // Note: Header is case-insensitive
---
>         // leave the current
314,315c313,314
<
<         hdr = getHeaderValue(responseHeaders, "Set-Cookie2");
---
>
>         hdr = (String) responseHeaders.get ("Set-Cookie2");
324c323
<         hdr = getHeaderValue(responseHeaders, "Set-Cookie");
---
>         hdr = (String) responseHeaders.get ("Set-Cookie");
370,386d368
<
<   /**
<    * Obtain a header value from the table using a case in-sensitive
search.
<    * @param headers A colletion of headers from the http response
<    * @param headerName The name of the header to find
<    * @return The header value or null if not found
<    */
<   private String getHeaderValue(Hashtable headers, String headerName)
<   {
<     for (Enumeration enum = headers.keys(); enum.hasMoreElements();)
<     {
<       String key = (String)enum.nextElement();
<       if (key.equalsIgnoreCase(headerName))
<         return (String)headers.get(key);
<     }
<     return null;
<   }

Thanks,
Elaine

Gunnar Osterode wrote:

> I'm using SOAP-RPC and send multiple requests within on HTTPSession. I've
> deployed a StatefulSessionBean with the scope "Session". At the client side
> I use the same Call object for all requests and I guess the HTTPSession is
> maintained ( the "Set-Cookie" HTTP header field including the JSESSIONID
> only comes with the first response). Nevertheless for every request a new
> instance of the SessionBean is created.
>
> Any suggestion would be great.
>
> Best regards,
> Gunnar


Re: SOAP-RPC and stateful session EJB

Posted by Elaine Chien <el...@sun.com>.
You may be hitting the cookie header bug.  The problem is that a case sensitive
search of set-cookie header is used. So if the web server you are using does
not set the cookie header name as "Set-Cookie", the cookie header won't get
picked up. See below for the patch request that Warwick Slade submitted.

[Attachment #2 (multipart/alternative)]

Patch to perform a case insensitive search on http header.

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.3315.2870" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Patch to perform a case insensitive search on
http
header.</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

["patchfile.txt" (text/plain)]

5c5
<  * Copyright (c) 2000 The Apache Software Foundation.  All rights
---
>  * Copyright (c) 2000 The Apache Software Foundation.  All rights
13c13
<  *    notice, this list of conditions and the following disclaimer.
---
>  *    notice, this list of conditions and the following disclaimer.
21c21
<  *    if any, must include the following acknowledgment:
---
>  *    if any, must include the following acknowledgment:
29c29
<  *    software without prior written permission. For written
---
>  *    software without prior written permission. For written
266c266
<         }
---
>         }
272c272
<       headers.put (Constants.HEADER_SOAP_ACTION,
---
>       headers.put (Constants.HEADER_SOAP_ACTION,
311,312c311
<         // leave the current
<         // Note: Header is case-insensitive
---
>         // leave the current
314,315c313,314
<
<         hdr = getHeaderValue(responseHeaders, "Set-Cookie2");
---
>
>         hdr = (String) responseHeaders.get ("Set-Cookie2");
324c323
<         hdr = getHeaderValue(responseHeaders, "Set-Cookie");
---
>         hdr = (String) responseHeaders.get ("Set-Cookie");
370,386d368
<
<   /**
<    * Obtain a header value from the table using a case in-sensitive
search.
<    * @param headers A colletion of headers from the http response
<    * @param headerName The name of the header to find
<    * @return The header value or null if not found
<    */
<   private String getHeaderValue(Hashtable headers, String headerName)
<   {
<     for (Enumeration enum = headers.keys(); enum.hasMoreElements();)
<     {
<       String key = (String)enum.nextElement();
<       if (key.equalsIgnoreCase(headerName))
<         return (String)headers.get(key);
<     }
<     return null;
<   }

Thanks,
Elaine

Gunnar Osterode wrote:

> I'm using SOAP-RPC and send multiple requests within on HTTPSession. I've
> deployed a StatefulSessionBean with the scope "Session". At the client side
> I use the same Call object for all requests and I guess the HTTPSession is
> maintained ( the "Set-Cookie" HTTP header field including the JSESSIONID
> only comes with the first response). Nevertheless for every request a new
> instance of the SessionBean is created.
>
> Any suggestion would be great.
>
> Best regards,
> Gunnar