SOAP cookie header

Forum for discussing SOAP, and how it is used in the E-conomic API

SOAP cookie header

Postby Woodgnome » Tue Nov 09, 2010 12:58 pm

I am currently trying to access the WSDL SOAP services using Google Apps Script SOAP to extract time registrations.

The API module is registered (and enabled) and the user I use to connect with has full access (bookkeeping, invoice etc.)

I can run the SOAP Connect function fine and I get the token back, but any further soap requests fail with the exception: <faultstring>Economic.Api.Exceptions.AuthenticationException(E02250): User is not authenticated. Access denied. {id=xxxxxxxxx}</faultstring><detail />.

I've tried debugging this using the PHP SOAP client library which works fine and inspecting the HTTP headers I can see that there is a Cookie header. I suspect the authentication exception is generated because it needs to be explicitly set when using Google SOAP (as opposed to PHP SOAP) and thus it is missing.

Full HTTP headers info:
Host: www.e-conomic.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.6-1+lenny9
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://e-conomic.com/Debtor_GetAll"
Content-Length: 222
Cookie: ASP.NET_SessionId=yyyyyyyyyyy;

As far as I am aware it is not possible to send HTTP headers with Google SOAP - it is, however, possible to send SOAP headers in the request. Unfortunately I have not been able to get this to work...

So my first question is: Is it even possible to use the SOAP headers to send the ASP.NET_SessionId cookie?

If yes, what is the proper XML syntax of the header? I've tried (and failed) with the following syntaxes so far):

<SOAP-ENV:Header>
<Cookie>ASP.NET_SessionId=yyyyyyyyyyy</Cookie>
</SOAP-ENV:Header>

<SOAP-ENV:Header>
<Cookie><ASP.NET_SessionId>mgtpgc55x4apim55f4wdi255</ASP.NET_SessionId></Cookie>
</SOAP-ENV:Header>

<SOAP-ENV:Header>
<ASP.NET_SessionId>mgtpgc55x4apim55f4wdi255</ASP.NET_SessionId>
</SOAP-ENV:Header>
-
Woodgnome
 
Posts: 1
Joined: Tue Nov 09, 2010 12:50 pm

Re: SOAP cookie header

Postby pederb » Fri Dec 17, 2010 11:51 pm

I have the same problem. Error E02250.

The Connect method returns an encrypted string.

I dont use a precompiled stub, but the native SOAP methods in Google Apps, so I presume the header must be set up manually.

Can anyone tell what information must be sent in the SOAP header?
-
pederb
 
Posts: 3
Joined: Fri Dec 17, 2010 11:09 pm

Re: SOAP cookie header

Postby pederb » Wed Jan 12, 2011 8:45 pm

Google Apps Script does not support HTTP cookies in the builtin SOAP methods.
The e-conomic API relies on ASP.NET session cookie so it is not possible to use these methods.

Googles more native UrlFetch methods could be used, but that is not an easy task.

I hope in the near future there will be a stateless REST implementation of the e-conomics API ;)
-
pederb
 
Posts: 3
Joined: Fri Dec 17, 2010 11:09 pm


Return to SOAP