Reputation: 405
I have automated web unit test cases based on HttpUnit version 1.7 , they ran fine when I ran against my application deployed in websphere 7, however after a websphere upgrade to version 8.5.5 it seems that the cookie information is not getting preserved and test fails when I run it with Httpunit , but with browser test runs fine.
In websphere 7 and Http unit
Header: User-Agent >httpunit/1.5<
Header: Cookie >JSESSIONID=0000ynL11KFNT4HCpj9_U6Ysyj0:-1<
Header: Accept-Encoding >gzip<
Header: Referer >http://<server>:9191/mas/control/cp/ST_SelaaTarvikkeita?uid=10000030<
Header: Cache-Control >no-cache<
Header: Pragma >no-cache<
Header: Host >localhost:9191<
Header: Accept >text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2<
Header: Connection >keep-alive<
**In websphere 8.5.5 and Http unit **
User-Agent >httpunit/1.5<
Accept-Encoding >gzip<
Header: Referer >http://<server>:9191/mas/control/cp/ST_SelaaTarvikkeita?uid=10000030<
Header: Cache-Control >no-cache<
Header: Pragma >no-cache<
Header: Host >localhost:9191<
Header: Accept >text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2<
Header: Connection >keep-alive<
** websphere 8.5.5 with Browser**
Header: Accept >application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*<
Header: Referer >http://<server>:9191/mas/control/cp/ST_SelaaTarvikkeita?uid=10000030<
Header: Accept-Language >fi-FI<
Header: User-Agent >Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)<
Header: Accept-Encoding >gzip, deflate<
Header: Host >localhost:9191<
Header: Connection >Keep-Alive<
Header: Cookie >JSESSIONID=0000TWDUPWXRyI3zl8asa-CAkjG:-1; sessionCode=0; LtpaToken2=SYmGb0YAKG2NJzc80oJQ9OkNrV0MWLnS3Z3h<
Upvotes: 1
Views: 739
Reputation: 405
I think I have found a solution for this .. Also yes the cookie setting was enabled from the server ok.
According to the Cookie specification(http://www.faqs.org/rfcs/rfc2965.html),sites may specify path to restrict the scope of their cookies.. Unfortunately,it may be so that some server do not follow the spec as it is . By default, HttpUnit is very strict about implementing the spec,and will reject such cookies. This behavior can be controlled by the class CookieProperties class as I did above.
So setting CookieProperties.setPathMatchingStrict(false); (Specifies whether strict path name matching must be followed.)
resolves the problem.
Upvotes: 0
Reputation: 4448
Have you tried reviewing the Session Cookies settings from Domain Manager administration console:
To view this, click Servers > Server types > WebSphere application servers > server_name > Session management > Enable cookies
Upvotes: 0