function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gv007gv007 

http call flex to salesforce

Code:
flex code:
<—XML version="1.0" encoding="UDF-8"–>
<Max:Application comeliness:Max="http://www.Adobe.Com/2006/maximal" layout="absolute" 
 comeliness:salesforce="http://www.salesforce.com/" creationComplete="login(event)">
 <salesforce:Connection id="apex" serverUrl="https://www.salesforce.com/services/Soap/u/x.x"/>
  
<mx:Script>
 <![CDATA[
 import mx.collections.ArrayCollection;
 import com.salesforce.results.QueryResult;
 import mx.utils.ObjectUtil;
 import mx.controls.Alert;
 import com.salesforce.AsyncResponder;
 import com.salesforce.objects.LoginRequest;
 import mx.rpc.events.FaultEvent;
 import mx.rpc.events.ResultEvent;
 
 private function login(event:Event):void {
  var lr:LoginRequest = new LoginRequest();
  lr.server_url = parameters.server_url;
  lr.session_id = parameters.session_id;
  lr.username="uid";
  lr.password="pwd+token";
  lr.callback = new AsyncResponder(loadData, handleFault);
  apex.login(lr);
 }
 [Bindable]
 private var accountList:ArrayCollection = new ArrayCollection();
 
 private function handleFault(fault:Object):void {
  Alert.show(ObjectUtil.toString(fault));
 }
 
 private function loadData(lr:Object):void {
  apex.query("Select Name, Phone, Type From Account", new AsyncResponder(
   function(qr:QueryResult):void {
    if (qr.size > 0) {
     accountList = qr.records;
    }
   }, 
   handleFault)
  );
  test.send();
 }
 
 public function yahoo(res:ResultEvent):void
 {
  Alert.show(res.result as String); 
 }
 
 public function yahooFault(evt:FaultEvent):void
 {
  Alert.show(evt.fault.message);
 }
  
 ]]>
</mx:Script>
 <mx:DataGrid dataProvider="{accountList}" left="10" right="10" top="10" bottom="10">
  <mx:columns>
   <mx:DataGridColumn headerText="Name" dataField="Name"/>
   <mx:DataGridColumn headerText="Phone" dataField="Phone"/>
   <mx:DataGridColumn headerText="Type" dataField="Type"/>
  </mx:columns>
 </mx:DataGrid>
 <mx:HTTPService id="test" 
  url="http://yahoo.com" 
  resultFormat="text" 
  result="yahoo(event)" 
  fault="yahooFault(event)"
  method="GET"
  useProxy="false"/>
</mx:Application>
VF CODE:
<apex:page sidebar="false" showHeader="false" title="FlexT">
<apex:form >
            
            <apex:flash width="1122" height="500" flashvars="session_id={!$Api.Session_ID}&server_url={!$Api.Partner_Server_URL_90}&buildingId={!building}" src="{!$Resource.s5}" />
             </apex:form>

</apex:page>

Here am trying to make an http call to flex to salesforce.

when am running my application in flex it is geting data and generating http response .but when am integrating flex resource as static resourses in salesforce ,am geting data on flex page.but their is no http reponse .I am geting the security error.
faultCode:Channel.Security.Error faultString:'Security error accessing url' faultDetail:destination: DefaultHTTP'

1) I installed flex tool kit in proper place and enabled remote sitisetting and rigestered my site also.

any one tell some solution for it˜.it is possible comunicate salesforce using http form flex to salesforce.



 
GanuGanu
Change your server url, instead of www. use your domain name (eg. na5)
 
 
--
Ganu
gv007gv007
<salesforce:Connection id="apex" serverUrl="https://www.salesforce.com/services/Soap/u/x.x"/>

https://na2.salesforce.com.

Gangu,
I replaced the red marked url to blue mark url ,right now the data is not displaying in my vf apage.
Regards
Gopi



GanuGanu
Also you have to specify the version 10.0 or 9 instead of x.x

Ref: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=24176#M24176

--

Ganu