WebService session sessionstate SOAP

J

jb

*Please* help --- I'm tearing my hair out.

I want to use sessionstate in a webservice, accessed from a client, written
in script (JScript, InfoPath).

I have written my webservice (C# .NET). I have marked the method(s) with
EnableSession=true. I have read everything there is to read! I am told that
to reuse session, my client needs to receive a cookie in the header from the
webservice and then pass this back in all future calls. This can all be
found in HttpWebClientProtocol.CookieContainer. I am told to "Assign the
CookieContainer to the proxy class" in the web client.

But my client isn't a C# .NET app! It's JScript in InfoPath.

I have written code there to invoke the webmethod via SOAP/XMLHTTP, so I'm
in charge of stuff. The call works fine, minus session stuff. But I cannot
see where what I need for preserving the session is kept/accessed? As I
understand it, I'm just looking to preserve a cookie for "sessionid" that
will be in the "header" (SOAP header? HTTP header?) sent to me from the
webservice?

I'm lost & frustrated...
 
D

Dan Rogers

Hi Jb,

When using session state based in cookies, you have to realize that this is
an HTTP request feature, and not a SOAP envelope or XML feature. You would
do this in the same way you would if you were writing a web browser and had
to write cookies.

Another option you have is to set up database enabled session state. This
is a pretty heavy handed step. Another choice you have is to include some
XML payload that is used to manage state on your own. You could do this
with SOAP headers, or by adding a special collection to your request/return
types for passing state.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: WebService session sessionstate SOAP
thread-index: AcTWQ73ffiT/M31bSg2mjWXTC+NO4w==
X-WBNR-Posting-Host: 82.152.32.104
From: "=?Utf-8?B?amI=?=" <[email protected]>
Subject: WebService session sessionstate SOAP
Date: Mon, 29 Nov 2004 10:46:31 -0800
Lines: 22
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.xml.soap,microsoft.public.dotnet.framework.aspnet.webservic
es,microsoft.public.dotnet.framework.webservices,microsoft.public.infopath
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26853
microsoft.public.dotnet.framework.webservices:7681
microsoft.public.infopath:14400 microsoft.public.xml.soap:7292
 
B

Brian Teutsch [MSFT]

InfoPath as a client doesn't respect the session cookie. You'll have to
receive the web service through script and store the header information into
the DOM somewhere, and handle the cookie get/send yourself. Sorry I don't
have any more information on how to do this, but at least you can stop
looking for something automatic within InfoPath.

Brian
 
J

jb

Brian,

Thanks for the reply.

Is it possible you're wrong, or I'm *totally* misunderstanding what's going
on? 'Coz now I'm even *more* mystified!

First, forget about SOAP. I think I understand I'm talking about HTTP
headers.

I'm finding, empirically, that my session & state *are* being preserved,
even though I've done nought in InfoPath! Yet you say:
InfoPath as a client doesn't respect the session cookie.
Debugging at the webservice side, I see a session being created for the
first IP request. Then no new session for subsequent requests, and my WS
sees its Session[] variables as it set them up last request. Session times
out as usual after inactivity for a while, as per web.config.

I switch on debugging in IIS to include showing "cookies". For all requests
(after the first) coming in from IP I see at the end of the trace info all
the "cookies", *including* "ASP.NET_SessionId=......." at the end.

This is being passed from IP, right? And the fact it's there is causing the
WS to reuse existing session, right? What am I failing to understand? I
find *all* IP sessions on my machine (no matter what IP form), to the same WS
at least, use the same WS session; any IP sessions from another machine use a
different session.

Maybe I'm not very clear about what I'm wanting/trying to understand. There
are really 2 different things, I don't quite understand how they are related:

1. My WS must see the same session for subsequent requests from the same IP
client (machine will probably do), as indicated by when Session_Start() in
Global.asax.cs gets called. I find this is true. This is vital.

2. My WS sees the same variables/contents in its Session[] bucket for
subsequent requests from the same IP client (machine will probably do). I
find this is true. This is *not* so vital, so long as I know what the case
will be --- I can code as necessary.

I should be *so* grateful if you/whoever would explain.
 
M

Matthew Blain \(Serriform\)

I expect you'll have to add the session as a paremeter in the web service
methods. InfoPath is probably relying on something underneath which assumes
that HTTP is stateless, and any shared info can safely be shared across all
calls on the machine--possibly including IE and multiple InfoPath forms.

I have no idea what InfoPath does internally, but this might be a feature
request for future versions. But the inherent statelessness of HTTP means
that relying on sessions may not be such a good idea. Since cookies are not
really part of SOAP (I don't think, I may be wrong), a client can choose to
implement cookie handling any way it wants and still be a perfectly valid
Web Service client.

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com


jb said:
Brian,

Thanks for the reply.

Is it possible you're wrong, or I'm *totally* misunderstanding what's going
on? 'Coz now I'm even *more* mystified!

First, forget about SOAP. I think I understand I'm talking about HTTP
headers.

I'm finding, empirically, that my session & state *are* being preserved,
even though I've done nought in InfoPath! Yet you say:
InfoPath as a client doesn't respect the session cookie.
Debugging at the webservice side, I see a session being created for the
first IP request. Then no new session for subsequent requests, and my WS
sees its Session[] variables as it set them up last request. Session times
out as usual after inactivity for a while, as per web.config.

I switch on debugging in IIS to include showing "cookies". For all requests
(after the first) coming in from IP I see at the end of the trace info all
the "cookies", *including* "ASP.NET_SessionId=......." at the end.

This is being passed from IP, right? And the fact it's there is causing the
WS to reuse existing session, right? What am I failing to understand? I
find *all* IP sessions on my machine (no matter what IP form), to the same WS
at least, use the same WS session; any IP sessions from another machine use a
different session.

Maybe I'm not very clear about what I'm wanting/trying to understand. There
are really 2 different things, I don't quite understand how they are related:

1. My WS must see the same session for subsequent requests from the same IP
client (machine will probably do), as indicated by when Session_Start() in
Global.asax.cs gets called. I find this is true. This is vital.

2. My WS sees the same variables/contents in its Session[] bucket for
subsequent requests from the same IP client (machine will probably do). I
find this is true. This is *not* so vital, so long as I know what the case
will be --- I can code as necessary.

I should be *so* grateful if you/whoever would explain.

Brian Teutsch said:
InfoPath as a client doesn't respect the session cookie. You'll have to
receive the web service through script and store the header information into
the DOM somewhere, and handle the cookie get/send yourself. Sorry I don't
have any more information on how to do this, but at least you can stop
looking for something automatic within InfoPath.

Brian
 
D

Dan Rogers

Hi JB,

It's confusing to me whether your issues are solved or not. If session is
working, is there still a problem?

Regards

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: WebService session sessionstate SOAP
thread-index: AcTW+tPoi/E9wHG1QWaCZb+6c/gMUA==
X-WBNR-Posting-Host: 82.152.32.104
From: "=?Utf-8?B?amI=?=" <[email protected]>
References: <[email protected]>
Subject: Re: WebService session sessionstate SOAP
Date: Tue, 30 Nov 2004 08:37:05 -0800
Lines: 83
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.xml.soap,microsoft.public.dotnet.framework.aspnet.webservic
es,microsoft.public.dotnet.framework.webservices,microsoft.public.infopath
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA0
3.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26892
microsoft.public.dotnet.framework.webservices:7696
microsoft.public.infopath:14431 microsoft.public.xml.soap:7295
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Brian,

Thanks for the reply.

Is it possible you're wrong, or I'm *totally* misunderstanding what's going
on? 'Coz now I'm even *more* mystified!

First, forget about SOAP. I think I understand I'm talking about HTTP
headers.

I'm finding, empirically, that my session & state *are* being preserved,
even though I've done nought in InfoPath! Yet you say:
InfoPath as a client doesn't respect the session cookie.
Debugging at the webservice side, I see a session being created for the
first IP request. Then no new session for subsequent requests, and my WS
sees its Session[] variables as it set them up last request. Session times
out as usual after inactivity for a while, as per web.config.

I switch on debugging in IIS to include showing "cookies". For all requests
(after the first) coming in from IP I see at the end of the trace info all
the "cookies", *including* "ASP.NET_SessionId=......." at the end.

This is being passed from IP, right? And the fact it's there is causing the
WS to reuse existing session, right? What am I failing to understand? I
find *all* IP sessions on my machine (no matter what IP form), to the same WS
at least, use the same WS session; any IP sessions from another machine use a
different session.

Maybe I'm not very clear about what I'm wanting/trying to understand. There
are really 2 different things, I don't quite understand how they are related:

1. My WS must see the same session for subsequent requests from the same IP
client (machine will probably do), as indicated by when Session_Start() in
Global.asax.cs gets called. I find this is true. This is vital.

2. My WS sees the same variables/contents in its Session[] bucket for
subsequent requests from the same IP client (machine will probably do). I
find this is true. This is *not* so vital, so long as I know what the case
will be --- I can code as necessary.

I should be *so* grateful if you/whoever would explain.

Brian Teutsch said:
InfoPath as a client doesn't respect the session cookie. You'll have to
receive the web service through script and store the header information into
the DOM somewhere, and handle the cookie get/send yourself. Sorry I don't
have any more information on how to do this, but at least you can stop
looking for something automatic within InfoPath.

Brian
 
J

jb

From my investigations, session is working the way I would like, and so my
issues are solved (if a bit worryingly...)

This is now an "InfoPath" issue, and I will continue my comments in that
forum. Thanks for your interest.

Dan Rogers said:
Hi JB,

It's confusing to me whether your issues are solved or not. If session is
working, is there still a problem?

Regards

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: WebService session sessionstate SOAP
thread-index: AcTW+tPoi/E9wHG1QWaCZb+6c/gMUA==
X-WBNR-Posting-Host: 82.152.32.104
From: "=?Utf-8?B?amI=?=" <[email protected]>
References: <[email protected]>
Subject: Re: WebService session sessionstate SOAP
Date: Tue, 30 Nov 2004 08:37:05 -0800
Lines: 83
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.xml.soap,microsoft.public.dotnet.framework.aspnet.webservic
es,microsoft.public.dotnet.framework.webservices,microsoft.public.infopath
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA0
3.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26892
microsoft.public.dotnet.framework.webservices:7696
microsoft.public.infopath:14431 microsoft.public.xml.soap:7295
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Brian,

Thanks for the reply.

Is it possible you're wrong, or I'm *totally* misunderstanding what's going
on? 'Coz now I'm even *more* mystified!

First, forget about SOAP. I think I understand I'm talking about HTTP
headers.

I'm finding, empirically, that my session & state *are* being preserved,
even though I've done nought in InfoPath! Yet you say:
InfoPath as a client doesn't respect the session cookie.
Debugging at the webservice side, I see a session being created for the
first IP request. Then no new session for subsequent requests, and my WS
sees its Session[] variables as it set them up last request. Session times
out as usual after inactivity for a while, as per web.config.

I switch on debugging in IIS to include showing "cookies". For all requests
(after the first) coming in from IP I see at the end of the trace info all
the "cookies", *including* "ASP.NET_SessionId=......." at the end.

This is being passed from IP, right? And the fact it's there is causing the
WS to reuse existing session, right? What am I failing to understand? I
find *all* IP sessions on my machine (no matter what IP form), to the same WS
at least, use the same WS session; any IP sessions from another machine use a
different session.

Maybe I'm not very clear about what I'm wanting/trying to understand. There
are really 2 different things, I don't quite understand how they are related:

1. My WS must see the same session for subsequent requests from the same IP
client (machine will probably do), as indicated by when Session_Start() in
Global.asax.cs gets called. I find this is true. This is vital.

2. My WS sees the same variables/contents in its Session[] bucket for
subsequent requests from the same IP client (machine will probably do). I
find this is true. This is *not* so vital, so long as I know what the case
will be --- I can code as necessary.

I should be *so* grateful if you/whoever would explain.

Brian Teutsch said:
InfoPath as a client doesn't respect the session cookie. You'll have to
receive the web service through script and store the header information into
the DOM somewhere, and handle the cookie get/send yourself. Sorry I don't
have any more information on how to do this, but at least you can stop
looking for something automatic within InfoPath.

Brian

*Please* help --- I'm tearing my hair out.

I want to use sessionstate in a webservice, accessed from a client,
written
in script (JScript, InfoPath).

I have written my webservice (C# .NET). I have marked the method(s) with
EnableSession=true. I have read everything there is to read! I am told
that
to reuse session, my client needs to receive a cookie in the header from
the
webservice and then pass this back in all future calls. This can all be
found in HttpWebClientProtocol.CookieContainer. I am told to "Assign the
CookieContainer to the proxy class" in the web client.

But my client isn't a C# .NET app! It's JScript in InfoPath.

I have written code there to invoke the webmethod via SOAP/XMLHTTP, so I'm
in charge of stuff. The call works fine, minus session stuff. But I
cannot
see where what I need for preserving the session is kept/accessed? As I
understand it, I'm just looking to preserve a cookie for "sessionid" that
will be in the "header" (SOAP header? HTTP header?) sent to me from the
webservice?

I'm lost & frustrated...
 
J

jb

From my investigations, session is working the way I would like, and so my
issues are solved (if a bit worryingly...)

This is now an "InfoPath" issue, and I will continue my comments in that
forum. Thanks for your interest.

Dan Rogers said:
Hi JB,

It's confusing to me whether your issues are solved or not. If session is
working, is there still a problem?

Regards

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: WebService session sessionstate SOAP
thread-index: AcTW+tPoi/E9wHG1QWaCZb+6c/gMUA==
X-WBNR-Posting-Host: 82.152.32.104
From: "=?Utf-8?B?amI=?=" <[email protected]>
References: <[email protected]>
Subject: Re: WebService session sessionstate SOAP
Date: Tue, 30 Nov 2004 08:37:05 -0800
Lines: 83
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.xml.soap,microsoft.public.dotnet.framework.aspnet.webservic
es,microsoft.public.dotnet.framework.webservices,microsoft.public.infopath
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA0
3.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26892
microsoft.public.dotnet.framework.webservices:7696
microsoft.public.infopath:14431 microsoft.public.xml.soap:7295
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Brian,

Thanks for the reply.

Is it possible you're wrong, or I'm *totally* misunderstanding what's going
on? 'Coz now I'm even *more* mystified!

First, forget about SOAP. I think I understand I'm talking about HTTP
headers.

I'm finding, empirically, that my session & state *are* being preserved,
even though I've done nought in InfoPath! Yet you say:
InfoPath as a client doesn't respect the session cookie.
Debugging at the webservice side, I see a session being created for the
first IP request. Then no new session for subsequent requests, and my WS
sees its Session[] variables as it set them up last request. Session times
out as usual after inactivity for a while, as per web.config.

I switch on debugging in IIS to include showing "cookies". For all requests
(after the first) coming in from IP I see at the end of the trace info all
the "cookies", *including* "ASP.NET_SessionId=......." at the end.

This is being passed from IP, right? And the fact it's there is causing the
WS to reuse existing session, right? What am I failing to understand? I
find *all* IP sessions on my machine (no matter what IP form), to the same WS
at least, use the same WS session; any IP sessions from another machine use a
different session.

Maybe I'm not very clear about what I'm wanting/trying to understand. There
are really 2 different things, I don't quite understand how they are related:

1. My WS must see the same session for subsequent requests from the same IP
client (machine will probably do), as indicated by when Session_Start() in
Global.asax.cs gets called. I find this is true. This is vital.

2. My WS sees the same variables/contents in its Session[] bucket for
subsequent requests from the same IP client (machine will probably do). I
find this is true. This is *not* so vital, so long as I know what the case
will be --- I can code as necessary.

I should be *so* grateful if you/whoever would explain.

Brian Teutsch said:
InfoPath as a client doesn't respect the session cookie. You'll have to
receive the web service through script and store the header information into
the DOM somewhere, and handle the cookie get/send yourself. Sorry I don't
have any more information on how to do this, but at least you can stop
looking for something automatic within InfoPath.

Brian

*Please* help --- I'm tearing my hair out.

I want to use sessionstate in a webservice, accessed from a client,
written
in script (JScript, InfoPath).

I have written my webservice (C# .NET). I have marked the method(s) with
EnableSession=true. I have read everything there is to read! I am told
that
to reuse session, my client needs to receive a cookie in the header from
the
webservice and then pass this back in all future calls. This can all be
found in HttpWebClientProtocol.CookieContainer. I am told to "Assign the
CookieContainer to the proxy class" in the web client.

But my client isn't a C# .NET app! It's JScript in InfoPath.

I have written code there to invoke the webmethod via SOAP/XMLHTTP, so I'm
in charge of stuff. The call works fine, minus session stuff. But I
cannot
see where what I need for preserving the session is kept/accessed? As I
understand it, I'm just looking to preserve a cookie for "sessionid" that
will be in the "header" (SOAP header? HTTP header?) sent to me from the
webservice?

I'm lost & frustrated...
 
J

jb

Matthew,

If you're interested, see my response to Brian above. Thanks for your help.

Matthew Blain (Serriform) said:
I expect you'll have to add the session as a paremeter in the web service
methods. InfoPath is probably relying on something underneath which assumes
that HTTP is stateless, and any shared info can safely be shared across all
calls on the machine--possibly including IE and multiple InfoPath forms.

I have no idea what InfoPath does internally, but this might be a feature
request for future versions. But the inherent statelessness of HTTP means
that relying on sessions may not be such a good idea. Since cookies are not
really part of SOAP (I don't think, I may be wrong), a client can choose to
implement cookie handling any way it wants and still be a perfectly valid
Web Service client.

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com


jb said:
Brian,

Thanks for the reply.

Is it possible you're wrong, or I'm *totally* misunderstanding what's going
on? 'Coz now I'm even *more* mystified!

First, forget about SOAP. I think I understand I'm talking about HTTP
headers.

I'm finding, empirically, that my session & state *are* being preserved,
even though I've done nought in InfoPath! Yet you say:
InfoPath as a client doesn't respect the session cookie.
Debugging at the webservice side, I see a session being created for the
first IP request. Then no new session for subsequent requests, and my WS
sees its Session[] variables as it set them up last request. Session times
out as usual after inactivity for a while, as per web.config.

I switch on debugging in IIS to include showing "cookies". For all requests
(after the first) coming in from IP I see at the end of the trace info all
the "cookies", *including* "ASP.NET_SessionId=......." at the end.

This is being passed from IP, right? And the fact it's there is causing the
WS to reuse existing session, right? What am I failing to understand? I
find *all* IP sessions on my machine (no matter what IP form), to the same WS
at least, use the same WS session; any IP sessions from another machine use a
different session.

Maybe I'm not very clear about what I'm wanting/trying to understand. There
are really 2 different things, I don't quite understand how they are related:

1. My WS must see the same session for subsequent requests from the same IP
client (machine will probably do), as indicated by when Session_Start() in
Global.asax.cs gets called. I find this is true. This is vital.

2. My WS sees the same variables/contents in its Session[] bucket for
subsequent requests from the same IP client (machine will probably do). I
find this is true. This is *not* so vital, so long as I know what the case
will be --- I can code as necessary.

I should be *so* grateful if you/whoever would explain.

Brian Teutsch said:
InfoPath as a client doesn't respect the session cookie. You'll have to
receive the web service through script and store the header information into
the DOM somewhere, and handle the cookie get/send yourself. Sorry I don't
have any more information on how to do this, but at least you can stop
looking for something automatic within InfoPath.

Brian

*Please* help --- I'm tearing my hair out.

I want to use sessionstate in a webservice, accessed from a client,
written
in script (JScript, InfoPath).

I have written my webservice (C# .NET). I have marked the method(s) with
EnableSession=true. I have read everything there is to read! I am told
that
to reuse session, my client needs to receive a cookie in the header from
the
webservice and then pass this back in all future calls. This can all be
found in HttpWebClientProtocol.CookieContainer. I am told to "Assign the
CookieContainer to the proxy class" in the web client.

But my client isn't a C# .NET app! It's JScript in InfoPath.

I have written code there to invoke the webmethod via SOAP/XMLHTTP, so I'm
in charge of stuff. The call works fine, minus session stuff. But I
cannot
see where what I need for preserving the session is kept/accessed? As I
understand it, I'm just looking to preserve a cookie for "sessionid" that
will be in the "header" (SOAP header? HTTP header?) sent to me from the
webservice?

I'm lost & frustrated...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top