トップへ戻るニュースフォーラムFLASH-ML 過去ログBak@Flaダウンロードよくある質問と答
ログイン
ユーザ名:

パスワード:


パスワード紛失

新規登録
メインメニュー
メイン
   コーダーズルーム【スクリプト系】
     ActionScript 3.0で Google contacts API を利用 (400 Bad Request)
投稿するにはまず登録を

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
seizo
Åê¹ÆNo.46025
投稿日時: 2010-10-7 14:10
常連
居住地: 江戸川区の某所
投稿: 125
使用環境:
ActionScript 3.0で Google contacts API を利用 (400 Bad Request)
ActionScript 3.0を使って、Google contacts API を利用するソフトを作成しております。
下記の Googleサイトを参考に作っているのですが、新既コンタクトを作成(Creating contacts)する POST送信において
どうしても 「HTTP/1.1 400 Bad Request」が返ってきてしまいます。
http://code.google.com/intl/ja/apis/contacts/docs/3.0/developers_guide_protocol.html


Googleのサイトにも Folumがあり、ここにも多量の「Bad Request」についての書き込みがあります。
これら情報を漁り try & Error を繰り返してきましたが、解決に至っておりません。
勿論投稿もしましたが、私の下手な英語のせいか未だにレスポンスが頂けず、こちらのサイトに質問を
投げさせて頂きました。

(恥ずかしい英語ですが、こちらです↓)
http://www.google.com/support/forum/p/apps-apis/thread?tid=734eea30ae495064&hl=en


前置きが長くなりましたら、以下、現在試みているコードを添付します。
どうか、よろしくお願いします。m(_ _)m

//順序が逆ですが、最初に エラーのレスポンスを貼ります。

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=UTF-8
Date: Thu, 07 Oct 2010 04:35:36 GMT
Expires: Thu, 07 Oct 2010 04:35:36 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Content-Length: 33

Content is not allowed in prolog.


//以下が、現在試みているActionScript 3.0 コードです。

var CreateLoader:URLLoader;

function createSingleContactData():void{
//実際にはauthに ちゃんとした値が入ります。
   var DReq:URLRequest = new URLRequest("http://www.google.com/m8/feeds/contacts/default/full");
   DReq.method = URLRequestMethod.POST;
   DReq.requestHeaders.push(new URLRequestHeader("Authorization", "GoogleLogin auth=AAABBBCCCDDDEEEFFF"  ));
   DReq.requestHeaders.push(new URLRequestHeader("GData-Version", "3") );

   DReq.contentType = 'application/atom+xml';
   var requestVars:URLVariables = new URLVariables();
   requestVars.body =  retCreateXML();
   DReq.data = requestVars;

   CreateLoader = new URLLoader();
   CreateLoader.dataFormat = URLLoaderDataFormat.TEXT;
   CreateLoader.addEventListener(IOErrorEvent.IO_ERROR, createErr);
   CreateLoader.addEventListener(Event.COMPLETE , createComplete);
   CreateLoader.load( DReq );
}

function createErr(event:Event):void     { trace(ERR) }

function createComplete(event:Event):void{ trace(CreateLoader.data) }

//GoogleContactsサイトに記載の サンプルXMLをそのまま返す関数
function retCreateXML():String{
   var temp:String ="";
   temp +="<?xml+version='1.0'+encoding='UTF-8'+?>";
   temp +="<atom:entry xmlns:atom='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'>";
   temp +="<atom:category scheme='http://schemas.google.com/g/2005#kind' term='http://(長いので略)/2008#contact' />";
   temp +="<gd:name>";
   temp +="<gd:givenName>Elizabeth</gd:givenName>";
   temp +="<gd:familyName>Bennet</gd:familyName>";
   temp +="<gd:fullName>Elizabeth Bennet</gd:fullName>";
   temp +="</gd:name>";
   temp +="<atom:content type='text'>Notes</atom:content>";
   temp +="<gd:email rel='http://(長いので略)='E. Bennet' />";
   temp +="<gd:email rel='http://(長いので略).org' />";
   temp +="<gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>(206)555-1212</gd:phoneNumber>";
   temp +="<gd:phoneNumber rel='http://(長いので略)#home'>(206)555-1213</gd:phoneNumber>";
   temp +="<gd:im (長いので略)/g/2005#home' />";
   temp +="<gd:structuredPostalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>";
   temp +="<gd:city>Mountain View</gd:city>";
   temp +="<gd:street>1600 Amphitheatre Pkwy</gd:street>";
   temp +="<gd:region>CA</gd:region>";
   temp +="<gd:postcode>94043</gd:postcode>";
   temp +="<gd:country>United States</gd:country>";
   temp +="<gd:formattedAddress>1600 Amphitheatre Pkwy Mountain View</gd:formattedAddress>";
   temp +="</gd:structuredPostalAddress>";
   temp +="</atom:entry>";
   return(temp);
}


----------------
□NAME : せいぞう
□URL : http://www.5th-trend.com/

フラット表示 前のトピック | 次のトピック

題名 投稿者 日時
 » ActionScript 3.0で Google contacts API を利用 (400 Bad Request) seizo 2010-10-7 14:10
     Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) seizo 2010-10-8 8:16
     Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) 961832p 2010-10-8 14:10
       Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) seizo 2010-10-8 14:30
         Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) seizo 2010-10-8 17:04
           Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) 961832p 2010-10-8 18:34
             Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) seizo 2010-10-8 19:17
               Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) 961832p 2010-10-9 10:52
                 Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) seizo 2010-10-9 12:01
                   Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) seizo 2010-10-9 15:16
                     Re: ActionScript 3.0で Google contacts API を利用 (400 Bad Request) 961832p 2010-10-9 15:47

投稿するにはまず登録を
 
Copyright (C) 2003 FLASH-japan. All rights reserved.
Powered by Xoops