English 中文(简体)
有人知道salesforce.com的跨域策略文件是否更改了吗?
原标题:
  • 时间:2008-11-20 22:14:10
  •  标签:

突然,我的Flex应用程序无法通过其API连接到salesforce.com,我遇到了安全沙盒违规问题。登录凭据是正确的,我已经通过其他方式尝试过它们,并在下面对它们进行了模糊处理。

今天早些时候这还能用,当时我并没有编写代码。

还有谁遇到过这种情况或知道发生了什么?

这是返回给我的应用程序的异常。

Method name is: login
 A997F86A-36E9-DDDC-EC6B-BBEE23101466  producer connected.
 A997F86A-36E9-DDDC-EC6B-BBEE23101466  producer sending message  B89E5879-D7F7-E91E-2082-BBEE231054DD 
 direct_http_channel  channel sending message:
(mx.messaging.messages::HTTPRequestMessage)#0
  body = "<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/"><se:Header xmlns:sfns="urn:partner.soap.sforce.com"/><se:Body><login xmlns="urn:partner.soap.sforce.com" xmlns:ns1="sobject.partner.soap.sforce.com"><username>simon.palmer@***.com</username><password>***</password></login></se:Body></se:Envelope>"
  clientId = (null)
  contentType = "text/xml; charset=UTF-8"
  destination = "DefaultHTTPS"
  headers = (Object)#1
  httpHeaders = (Object)#2
    Accept = "text/xml"
    SOAPAction = """"
    X-Salesforce-No-500-SC = "true"
  messageId = "B89E5879-D7F7-E91E-2082-BBEE231054DD"
  method = "POST"
  recordHeaders = false
  timestamp = 0
  timeToLive = 0
  url = "https://www.salesforce.com/services/Soap/u/11.0"
Method name is: login
*** Security Sandbox Violation ***
Connection to https://www.salesforce.com/services/Soap/u/11.0 halted - not permitted from https://localhost/pm_server/pm/pm-debug.swf
 A997F86A-36E9-DDDC-EC6B-BBEE23101466  producer acknowledge of  B89E5879-D7F7-E91E-2082-BBEE231054DD .
 A997F86A-36E9-DDDC-EC6B-BBEE23101466  producer fault for  B89E5879-D7F7-E91E-2082-BBEE231054DD .
Comunication Error : Channel.Security.Error : Security error accessing url : Destination: DefaultHTTPS
Error: Request for resource at https://www.salesforce.com/services/Soap/u/11.0 by requestor from https://localhost/pm_server/pm/pm-debug.swf is denied due to lack of policy file permissions.
问题回答

你必须确保从/services目录树中加载策略,根目录的默认策略无法帮助你。你需要加载这个策略:https://www.salesforce.com/services/crossdomain.xml

解决这个问题的方法是将服务器协议和 URL 设置为以下内容:

apex = new Connection();    
apex.serverUrl = "https://na3.salesforce.com/services/Soap/u/14.0";
apex.protocol = "https";

然而,这似乎会引发一个用户被锁定的二级问题,因此非连接性仍然存在的问题。

更新:salesforce.com已经确认了一个错误。请见我其他相关帖子

你最近升级到了Flash Player 10吗?Flash Player 10在一定程度上改变了策略文件的工作方式,crossdomain.xml文件需要更新以解决此问题。简而言之,Salesforce.com可能还没有准备好应对用户升级至Flash Player 10。

我解决了这个问题,通过访问 Flash Player 配置面板(在开发环境中推荐使用),然后在“全局安全”选项卡中选择“始终允许”。

问候。

我从flex上传文件到Google文档。所有工作都在本地文件中进行,但是当我们将SWF文件作为Salesforce(sandbox)中的S控件上传时,在连接到Google时会出现错误。请查看以下错误:

Error:[FaultEvent fault=[RPC Fault faultString="Security error accessing url"
faultCode="Channel.Security.Error" faultDetail="Destination: DefaultHTTPS"] 
messageId="1F812836-1318-B845-AC01-F51AB1D11518" type="fault" bubbles=false 
cancelable=true eventPhase=2]

We tried the following solutions below but nothing seems to work: FLEX: - Add the crossdomain.xml in the bin-debug folder: below is the content of the cross domain policy.

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
     <allow-access-from domain="*" secure="false" />
<allow-http-request-headers-from domain="*" headers="*" secure="false" />
</cross-domain-policy>
  • Used flash.system.security.allowinsecuredomain/allowdomain(“*”) in the initialization.
  • Also tried in the connection.protocol set to http Salesforce:
  • Disabled the protocol security in the remote site settings o Setup -> Administration Setup -> Security Controls -> Remote Site Settings  URL: http://www.google.com.ph

在与Salesforce的连接方面没有问题,但在上传页面初始化时,安全错误将特别出现在onErrorFault函数中。以下是代码片段:

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="534" height="462" verticalScrollPolicy="off" horizontalScrollPolicy="off"
creationComplete="init()" showCloseButton="true" close="{this.closeWindow(event)}" roundedBottomCorners="true">
<mx:Script>
<![CDATA[

private function init():void{
        Security.allowInsecureDomain("*");
        //<salesforce:Connection id="apex" sendRequest="sendRequestListener(event)" serverUrl="http://www.salesforce.com/services/Soap/u/10.0" protocol="http"/>   
        RESTProxyTest();
        send_data();
        arrAddedFiles = new Array();
        this.uploadGrid.dataProvider= this.acFiles; 
        this.title = "Attachment: "+this.selectedTimeSheetDetail.Project.label;
}

public function RESTProxyTest():void
    {
        _conn = new NetConnection();
        _conn.addEventListener(AsyncErrorEvent.ASYNC_ERROR, doAsyncError);
        _conn.addEventListener(IOErrorEvent.IO_ERROR, doIOError);
        _conn.addEventListener(SecurityErrorEvent.SECURITY_ERROR, doSecurityError);
        _conn.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);
        _conn.objectEncoding = ObjectEncoding.AMF3;

        _conn.connect(_url);
        _responder = new Responder(onResult, onFault);  

    }

private function send_data():void {
        userRequest.url = getLoginURL();
        userRequest.addEventListener(ResultEvent.RESULT, httpResult);
        userRequest.addEventListener(FaultEvent.FAULT, onErrorFault); 
        userRequest.send();
    } 

private function onErrorFault(obj:FaultEvent):void
    {
        Alert.show("Error:"+obj.toString());
    }

private function httpResult(obj:ResultEvent):void
    {
        trace(obj.toString());

        var result:String = obj.result as String;       
        var pos:int = result.lastIndexOf("Auth=");
        var auth:String = result.substr(pos + 5);
        txtAuth.text = StringUtil.trim(auth);
        placeCall();
    }

protected function placeCall():void
    {
        trace("placeCall");
        var headers:Array = ["Authorization: " + "GoogleLogin auth=" + StringUtil.trim(txtAuth.text)];
        var postVars:Array = [];         
        var uri:String = "http://docs.google.com/feeds/documents/private/full?showfolders=true"; 
        _conn.call("RESTProxy.request", _responder, uri, "get", new Array(), postVars, headers);
    }

private function getLoginURL():String
    {
        var url:String =  https://www.google.com/accounts/ClientLogin?accountType=HOSTED_OR_GOOGLE&  +
         Email=  + this.session.config.gmail +  &  +
         Passwd=  + this.session.config.password +  &service=writely ; 

        return url;
    }   
]]>
</mx:Script>

<mx:HTTPService id="userRequest" useProxy="false" method="POST" contentType="application/x-www-form-urlencoded" showBusyCursor="true"/>




相关问题
热门标签