473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Web Service Session trouble :(

hi guys,

I've a couple of web services.

The first one authenticates a user, and saves the principal in the session
object.
The second one authorizes after reading the user data from the session.

Up to now, those two worked wonderfully, and we've had no problems with
them. but now, we're using NUnit to build some tests for the services, and a
C# class as the test. It first makes a call to the login service (which
succeeds) and then to the other service, which fails because there is no
current user principal in the session !

I though it was because the two service stubs were in different namespaces.
But I can't help that, VS.NET won't let you add two web references with the
same namespace name.

Does anybody know what might be going on here ?

Cheers,
Angel
O:]
Nov 18 '05 #1
3 1130
Angelos Karantzalis wrote:
hi guys,

I've a couple of web services.

The first one authenticates a user, and saves the principal in the
session object.
The second one authorizes after reading the user data from the
session.

Up to now, those two worked wonderfully, and we've had no problems
with them. but now, we're using NUnit to build some tests for the
services, and a C# class as the test. It first makes a call to the
login service (which succeeds) and then to the other service, which
fails because there is no current user principal in the session !

I though it was because the two service stubs were in different
namespaces. But I can't help that, VS.NET won't let you add two web
references with the same namespace name.

Does anybody know what might be going on here ?

Cheers,
Angel
O:]


Sessions work with cookies. Usually when you call a webservice from
some client, cookies are ignored!
You need to add a place to store those cookies: a CookieContainer.
First create one, then add it to the webservice calls that should work
with the same session.

Hans Kesting
Nov 18 '05 #2
i assume the web services are in the same vdir, if this is true, then
sessions will be shared - namespace does not matter.

you will also have to add support for the session cookie to your nunit code.
as the unit tests run in seperate domain, you will also need some way to
pass the session id from call1 to call2 (globals will not work)

you might want to have a predefined session id used by unit tests, then the
second caller can call a mocker of the authenication call to get the test
session id.

unless you are writing an acceptance test, i would not use the web service.
I would have unit tests call the modules directly, and supply a mocker for
the web service proxy.

-- bruce (sqlwork.com)

"Angelos Karantzalis" <ak**********@yahoo.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
| hi guys,
|
| I've a couple of web services.
|
| The first one authenticates a user, and saves the principal in the session
| object.
| The second one authorizes after reading the user data from the session.
|
| Up to now, those two worked wonderfully, and we've had no problems with
| them. but now, we're using NUnit to build some tests for the services, and
a
| C# class as the test. It first makes a call to the login service (which
| succeeds) and then to the other service, which fails because there is no
| current user principal in the session !
|
| I though it was because the two service stubs were in different
namespaces.
| But I can't help that, VS.NET won't let you add two web references with
the
| same namespace name.
|
| Does anybody know what might be going on here ?
|
| Cheers,
| Angel
| O:]
|
|
Nov 18 '05 #3
> Sessions work with cookies. Usually when you call a webservice from
some client, cookies are ignored!
You need to add a place to store those cookies: a CookieContainer.
First create one, then add it to the webservice calls that should work
with the same session.

Hans Kesting


Thanks Hans, that more or less what I'd figured. Could you point me to some
info on how to add a CookieContainer to the web service stubs ?

Cheers,
Angel
O;]
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Carson Saunders | last post by:
I have a C# client application that calls a web service. I implement the CookieContainer class on the client to ensure the session is kept. However, I'm having trouble with the session timeout. I...
0
by: RML | last post by:
Hi, I have created a Windows Service which when started, retrieves a file from an FTP server (running W2K Server) via an FTP call. The service is "dependant" on the lanmanworkstation service,...
7
by: Ahmed Perlom | last post by:
Hi all, I am trying to start a windows application that has a GUI from a Windows service written in .NET 2.0. I have been searching on this for few days now with no avail. When using the...
3
by: Dhruba Bandopadhyay | last post by:
I am a current ASP developer. I have files: ServiceClass.asp & SessionClass.asp which are included in many of my asp files. Then they call objService = New Service (by using the Class Service...
1
by: D-Someone | last post by:
I am re-posting this message as originially it did not get a single response.. Any ideas? -------------- I am trying to come up with a good design for a web service that has some user logic...
11
by: Joseph Geretz | last post by:
I've been looking at two approaches for the maintenance of Session state for a Web Service application. One approach uses the old familiar Session object which I've used in the past for Web...
3
dmjpro
by: dmjpro | last post by:
plz send me a good link which can clearify me how the J2EE framework works i want the details information .... plz help thanx
11
by: Glenn | last post by:
Hi I've been experimenting with managing state using the Session object. I've created a simple WS with a couple of methods, one which sets a string value, another that retrieves it. Each...
5
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
Hi All, I am using asp.net session state service to store session. The concurrent online user will be almost 2000. Could asp.net session state service afford this? Is there any limitation...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.