2010-09-09 45 views
1

目前我有:如何使用請求參數與的HTTPService特殊字符 - Flex的

<mx:HTTPService id="userLogin" url="https://api.localhost/api/user/login/" method="POST" resultFormat="e4x" result="doSomeThing(event)"> 
     <mx:request> 
      <email>{loginUser}</email> 
      <password>{loginPassword}</password> 
     </mx:request> 
    </mx:HTTPService> 

,而不是這個,我有一個像userCredentials.email和userCredentials.password PARAMS。 我試過這個,但它的工作。

<mx:HTTPService id="userLogin" url="https://api.localhost/api/user/login/" method="POST" resultFormat="e4x" result="doSomeThing(event)"> 
     <mx:request> 
      <userCredentials.email>{loginUser}</userCredentials.email> 
      <userCredentials.password>{loginPassword}</userCredentials.password> 
     </mx:request> 
    </mx:HTTPService> 
+0

你能量化「不起作用」嗎?實際發送了什麼?您是否使用Charles或Service Capture或Flash Builder網絡監視器等數據包嗅探器來查看它?你在處理這個請求的服務器頁面上得到什麼? – JeffryHouser 2010-09-09 22:20:32

+0

flex生成器給出錯誤。文檔中出現錯誤。它不會編譯。 – priyank 2010-09-10 19:02:28

回答

1

讓我們知道如果你工作:

<mx:HTTPService id="userLogin" url="https://api.localhost/api/user/login/" method="POST" resultFormat="e4x" result="doSomeThing(event)"> 
     <mx:request> 
      <userCredentials> 
       <email>{loginUser}</email> 
       <password>{loginPassword}</password> 
      </userCredentials> 
     </mx:request> 
    </mx:HTTPService> 

也沒看到這個從http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_5.html

<?xml version="1.0"?> 
<!-- fds\rpc\WebServiceSOAPRequest.mxml --> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalGap="10"> 
    <mx:WebService id="ws" wsdl="http://api.google.com/GoogleSearch.wsdl" 
     useProxy="true"> 
     <mx:operation name="doGoogleSearch" resultFormat="xml"> 
      <mx:request format="xml"> 
       <ns1:doGoogleSearch xmlns:ns1="urn:GoogleSearch" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
        <key xsi:type="xsd:string">XYZ123</key> 
        <q xsi:type="xsd:string">Balloons</q> 
        <start xsi:type="xsd:int">0</start> 
        <maxResults xsi:type="xsd:int">10</maxResults> 
        <filter xsi:type="xsd:boolean">true</filter> 
        <restrict xsi:type="xsd:string"/> 
        <safeSearch xsi:type="xsd:boolean">false</safeSearch> 
        <lr xsi:type="xsd:string" /> 
        <ie xsi:type="xsd:string">latin1</ie> 
        <oe xsi:type="xsd:string">latin1</oe> 
       </ns1:doGoogleSearch> 
      </mx:request> 
     </mx:operation> 
    </mx:WebService> 
</mx:Application> 

我的意思是MX:請求結構?