I am terribly puzzled - I am trying to do POST requests to Google API
(account creation and Calendar creation) but receive "400 Bad request"
error with explanation " org.xml.sax.SAXParseException: Content is not
allowed in prolog"

I am using:

1. Oracle UTL_HTTP package , Oracle version 9.2.0.7.0.

2. Authorisation is successful through ClientLogin authentication
method. I successfully get Authorisation token

3. GET requests are successful too, for example when I try to retrieve
Calendar data from 
http://www.google.com/calendar/feeds/default/owncalendars/full
I receive the information from calendars without any problem.

4. When I try to post to 
http://www.google.com/calendar/feeds/default/owncalendars/full
or https://www.google.com/a/feeds/gtest.leedsmet.ac.uk/user/2.0 (for e-
mail accounts creation)  I persistently receive 400 Bad request" error
with explanation "org.xml.sax.SAXParseException: Content is not
allowed in prolog"

5. We have used Solaris utility Snoop to retrieve information about
all traffic between our Oracle server and Google. The log is below and
doesn't seem to have any strange characters in exchange. As you see,
GET is successful and POST is not.

GET /calendar/feeds/default/owncalendars/full HTTP/1.1
Host: www.google.com
Cookie: S=calendar=anEuvLABNMA
Authorization: GoogleLogin
auth=DQAAAIYAAAASZPS7G46u1GjXcAyWD4fPOV1TrMM4P3V-
gaSZ3lj5J0AOlqtB7djqBG4Usg_CFg5KL1crSq3-0enw13EO7qSCJvJhYv1fXDDb_Ozc7dMi605_h77TDCPMY0vHkzKGK5LIZq7-4l3ss_jCrTxEaorgukqV-
_TgsyB0RZGONNUq0n9zzb8f0_zw88j1T2aewLw
Connection: close
HTTP/1.1 200 OK
Content-Type: application/atom+xml; charset=UTF-8
Cache-Control: max-age=0, must-revalidate, private
Last-Modified: Thu, 08 Nov 2007 13:12:44 GMT
Transfer-Encoding: chunked
Date: Thu, 08 Nov 2007 13:12:44 GMT
Server: GFE/1.3
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/
2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
xmlns:gCal='http://schemas.google.com/gCal/2005' xmlns:gd='http://
schemas.google.com/g/2005'>** calendar feed here, removed for space
saving **</feed>
POST /calendar/feeds/default/owncalendars/full HTTP/1.1
Host: www.google.com
Cookie: S=calendar=anEuvLABNMA
Content-Type: application/atom+xml
Content-Length: 486
Authorization: GoogleLogin
auth=DQAAAIYAAAASZPS7G46u1GjXcAyWD4fPOV1TrMM4P3V-
gaSZ3lj5J0AOlqtB7djqBG4Usg_CFg5KL1crSq3-0enw13EO7qSCJvJhYv1fXDDb_Ozc7dMi605_h77TDCPMY0vHkzKGK5LIZq7-4l3ss_jCrTxEaorgukqV-
_TgsyB0RZGONNUq0n9zzb8f0_zw88j1T2aewLw
Connection: close
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://
schemas.google.com/g/2005' xmlns:gCal='http://schemas.google.com/gCal/
2005'><title type='text'>Little League Schedule</title><summary
type='text'>This calendar contains the practice schedule and game
times.</summary> <gCal:timezone value='America/Los_Angeles'></
gCal:timezone> <gCal:hidden value='false'></gCal:hidden><gCal:color
value='#2952A3'></gCal:color><gd:where rel='' label=''
valueString='Oakland'></gd:where></entry>
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=UTF-8
Transfer-Encoding: chunked
Cache-control: private
Date: Thu, 08 Nov 2007 13:12:44 GMT
Server: GFE/1.3
org.xml.sax.SAXParseException: Content is not allowed in prolog.

6. Just in case,  source PL/SQL of the whole thing, using UTL_HTTP
package:

v_req := Utl_Http.Begin_Request (
         url => v_url,
         method => 'GET' );
UTL_HTTP.SET_HEADER(v_req, 'Authorization', v_auth_header);
v_resp := Utl_Http.Get_Response ( r => v_req );
loop
      Utl_Http.Read_Text (
      r => v_resp,
      data => v_msg );
end loop;
UTL_HTTP.END_RESPONSE(v_resp);
UTL_HTTP.SET_HEADER(v_req, 'Content-Type', 'application/atom+xml');
UTL_HTTP.SET_HEADER(v_req, 'Content-Length', length(v_body));
UTL_HTTP.SET_HEADER(v_req, 'Authorization', v_auth_header);
UTL_HTTP.WRITE_TEXT(v_req, v_body);
v_resp := UTL_HTTP.GET_RESPONSE(v_req);
loop
      Utl_Http.Read_Text (
      r => v_resp,
      data => v_msg );
end loop;
UTL_HTTP.END_RESPONSE(v_resp);


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to