【问题标题】:Flex HttpService authorization to obtain xml feedFlex HttpService 授权获取 xml 提要
【发布时间】:2013-05-20 14:14:15
【问题描述】:

我试图通过 API 从我的 cpanel 获取 xml 提要。我已经尝试了几种方法(见下文)来通过授权来获取 xml 提要。

在我的浏览器中,我可以通过以下方式获取提要:

http://user:pass@domain.com:2086/xml-api/listaccts?

来自服务器的提要示例:

<listaccts>
<acct>
<disklimit>2500M</disklimit>
<diskused>56M</diskused>
<domain>domain.com</domain>
<email>dot@domain.com</email>
<ip>xx.xx.xx.xx</ip>
<max_defer_fail_percentage>unlimited</max_defer_fail_percentage>
<max_email_per_hour>unlimited</max_email_per_hour>
<maxaddons>*unknown*</maxaddons>
<maxftp>5</maxftp>
<maxlst>*unknown*</maxlst>
<maxparked>*unknown*</maxparked>
<maxpop>25</maxpop>
<maxsql>1</maxsql>
<maxsub>5</maxsub>
<min_defer_fail_to_trigger_protection>5</min_defer_fail_to_trigger_protection>
<owner>root</owner>
<partition>home</partition>
<plan>Basic</plan>
<shell>/usr/local/cpanel/bin/noshell</shell>
<startdate>13 Feb 17 07:05</startdate>
<suspended>0</suspended>
<suspendreason>not suspended</suspendreason>
<suspendtime/>
<theme>x3</theme>
<unix_startdate>1361109935</unix_startdate>
<user>xxxxxxxx</user>
</acct>
</listaccts>

我的应用程序脚本:

<s:HTTPService id="clientList" method="GET" resultFormat="e4x"/>

在脚本中:

[Bindable]
private var clientInfo:Object = new Object();

private function clients(event:Event):void{

            clientList.url = 'http://' +loginUsername.text
            clientList.url += ':' + loginPassword.text
            clientList.url += '@' + loginServer.text;
            clientList.url += ':2086/xml-api/listaccts?';

            clientList.addEventListener("result", clientResult); 
            clientList.addEventListener("fault", clientFault); 
            clientList.send();

            CursorManager.setBusyCursor();

        }

        public function clientResult(event:ResultEvent):void { 


            clientInfo = clientList.lastResult.acct;
            CursorManager.removeBusyCursor();

        } 

        public function clientFault(event:FaultEvent):void { 

            var faultstring:String = event.fault.faultString;  
            Alert.show("Unable to obtain client list","Error"); 

            CursorManager.removeBusyCursor();
        }

我做错了什么,我一直收到错误(无法获取客户端列表),我想我可能正在尝试我使用的身份验证方式。

【问题讨论】:

    标签: actionscript-3 apache-flex flex4 xmlhttprequest httpservice


    【解决方案1】:

    不要连接字符串来添加您的用户名和密码。

    将其称为 WebService 并使用 setCredentials。

    【讨论】:

    • 你有没有样品可以让我看看?不是 Flex 编程专家。
    猜你喜欢
    • 2019-04-26
    • 2010-09-21
    • 2011-09-23
    • 1970-01-01
    • 2010-11-11
    • 1970-01-01
    • 2012-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多