Unless something has changed, you can't access the Google Search webservice 
from within Flash/Flex, because there's no crossdomain 
policy file on their server.

cross-domain policy file/cross-domain file access:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14213

You'll need to proxy the call to the Webservice

regards,
Muzak

----- Original Message ----- 
From: "garylee0709" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, September 18, 2006 5:07 PM
Subject: [flexcoders] i use the api that google provides to make flex rearch 
page,but...


i failed to success,here is my code,hope you can help finding the
mistakes...thank you very much!!!

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
<mx:Script>
<![CDATA[
public var searchTerm:String;
public var selectedItem:Object;
public function initpp():void{
searchTerm=ti.text;
ws.doGoogleSearch.send();
}
]]>
</mx:Script>
<mx:WebService id="ws"
wsdl="http://api.google.com/GoogleSearch.wsdl";
result="{ti.text='yes'}" fault="{ti.text='no'}">
<mx:operation name="doGoogleSearch">
<mx:request>
<key>keys i applied from http://www.google.com/apis</key>
<start>0</start>
<maxResults>10</maxResults>
<filter>true</filter>
<safeSearch>true</safeSearch>
<q>{searchTerm}</q>
</mx:request>
</mx:operation>
</mx:WebService>
<mx:Panel x="171" y="53" title="Google SOAP Search API">
<mx:TextInput id="ti"/>
<mx:Button label="Search" click="initpp()"/>
<mx:DataGrid id="resultsGrid"
change="selectedItem=event.target.selectedItem"
dataProvider="{ws.doGoogleSearch.result.resultElements}">
<mx:columns>
<mx:DataGridColumn headerText="URL"
dataField="URL"/>
<mx:DataGridColumn headerText="title"
dataField="title"/>
</mx:columns>
</mx:DataGrid>
<mx:LinkButton label="{selectedItem.URL}"/>
</mx:Panel>
</mx:Application>









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to