views:

613

answers:

1

Hi,

I'm writing Qt client for ASP.NET web service with FORMS based authenitcation.

The service consists of 3 methods: Login(user,pass) Helloworld() - this method returns info oabout athenticated user. Logout()

Every thing working fine on the dot.net client with CookieContainer.

The problem begins with HelloWorld() methods. it returns null beause I can't access server session.

I'm doing the following:

from the response of Login() request i'm getting the cookies which are sent to client: QNetworkAccessManager *manager = http.networkAccessManager(); cookie = manager->cookieJar();

When sending the second soaprequest for HelloWorld method I adding these cookies to QtSoapHttpTransport http:

http.networkAccessManager()->setCookieJar(cookie)

but the request which is going from server is empty.

I moved futher with my investigation and monitored HTTP traffic coming to server from Qt cleint and .NET client.

The HTTP Header for both SOAP requests are diffeent:

This is Request coming from .NET client

POST /test/service1.asmx HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3053)
VsDebuggerCausalityData: uIDPoyhZznNkbItPkJSR3EA+zEIAAAAAUkpe7URduE6nmhnT8f uQeqCQBMlX0zxCm65yW4ZPBkUACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://localhost/test/HelloWorld"
Host: localhost:8080
Cookie: MyAuthenCookie=DC7620DA79E080FECA37AC6866BF2690D57 B37443506F0D7EEA9DF209827360894D80D37E1B121D73EE44 766BDAEE16BA3FB0E8B95ADB1252AB00A76706930ACDC87CF9 F26744B7E9E3EB7FBB3812997
Content-Length: 291
Expect: 100-continue 

and this is Request coming from Qt soap client:

POST /test/Service1.asmx HTTP/1.1
Content-Type: text/xml;charset=utf-8
SOAPAction: http://localhost/test/HelloWorld
Content-Length: 350
Cookie: MyAuthenCookie=9AFB2B22EE78D19DFD52BD2193A3D71627C F7303C15E4354E43CC2F31AECBDFFAD09176AA45F33B35C3C3 73891F1FE994580E8EE70FD4D01507670743138E74E152CFF4 EB3C37D90D3A7A0E272A804C3
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: Mozilla/5.0
Host: localhost:8080 

Does any body have any idea what might be the problem and hoe to solve it?

How can I modify Headers for HTTP POST request in QtSoapHttpTransport object in order to make it identical to .NET request?

Thank you in advance, Danny.

+1  A: 

Are you running IIS or the ASP.NET Development server?

I was able to recreate a similar problem where everything worked fine using ASP.NET Development server but under IIS the session was null.

One thing to look for is when you invoke the session-enabled-service you should see the ASP.NET_SessionId being set in the response headers

Set-Cookie: ASP.NET_SessionId=5vxqwy45waoqma45lbbozj45; path=/; HttpOnly
Set-Cookie: MyAuthenCookie=510969D70201B358F8B0BBEEE7E79316B7ABCCC74312B0BD678DA4BE90E5C51CD6E7CDCA486DDB41BCBF489DB7280B3B979FD70B78D7F63B03C33431ADDAFDCA; expires=Mon, 07-Dec-2009 06:41:04 GMT; path=/; HttpOnly

To get sessions working under IIS, I had to add the following to web.config under system.web:

<sessionState mode="InProc" cookieless="false" timeout="20" />
<httpModules>
  <add name="Session" type="System.Web.SessionState.SessionStateModule" 
</httpModules>

This was under Windows 2003.

Tuzo
Hi, Yes. sure, and it work perfectly from dotNET client
danny.lesnik