2010-04-05 142 views
0

我想將數據插入到SQL Server,但我不斷收到此錯誤Flex 3和肥皂響應?

RPC故障faultString =「SOAP響應不能被解碼的原始響應:Fault代碼=」 DecodingError」 faultDetail =‘空’]

我可以一整天獲取數據,但爲什麼我不能輸入任何?

<mx:WebService id="ws" wsdl="http://localhost:/AService01.asmx?wsdl" 
fault="onFault(event)"> 
<mx:operation 
name="GetEmployees" 
resultFormat="object" 
result="GetEmployees(event)"/> 

</mx:WebService> 

<mx:Script> 
import mx.collections.ArrayCollection; 
import mx.controls.Alert; 
import mx.controls.DataGrid; 
import mx.rpc.events.FaultEvent; 
import mx.rpc.events.ResultEvent; 
import mx.rpc.wsdl.WSDLBinding; 

private function init():void 
{ 
    ws.GetEmployees(); 
} 
[Bindable] 
private var res:ArrayCollection; 

private function GetEmployees(event:ResultEvent):void 
{ 
// Databind data from webservice to datagrid 

res = event.result as ArrayCollection; 
datagrid.dataProvider = res; 

//datagrid.dataProvider = event.result[1]; 
UserText.text = event.result[1].firstname + " " + event.result[1].email;// find a better way to get this... 
} 

private function onFault(event:FaultEvent):void { 
    Alert.show(event.fault.toString()); 
} 

private function AddRecord(event:Event):void 
{ 

// Save a record using a WebService method 
ws.SaveEmployee(txtFirstName.text, txtLastName.text, txtEmail.text, txtPhoneNum.text, txtAddress.text, txtCity.text, txtState.text, int(txtZip.text), txtBirthday.text as Date, txtPassword.text); 
} 
</mx:Script> 
+0

什麼編程語言的web服務寫? C#?嘗試從瀏覽器調用Web服務,以測試該功能是否正常工作。 – Pbirkoff 2010-04-05 23:50:48

+0

是的,它是用C#編寫的,兩種方法都可以在瀏覽器中正常工作。 – ryan 2010-04-05 23:52:49

+0

你在瀏覽器中運行Flex-app嗎?你可以使用FireBug來查看發送給WebService的值嗎?我想你沒有提供足夠的參數,或者轉換(int或date)導致無效值 – Pbirkoff 2010-04-06 00:01:20

回答

2

這個錯誤出現,當你在WS拋出異常,並試圖在Flex中正確分析檢查this升墨水更多信息。

Flex無法處理與HTTP 500狀態關聯的故障。在這種情況下你會得到一個DecodingError。這源於Flex在響應爲500時無法讀取故障的詳細信息。以下是實際的Fault Flex返回值。

[FaultEvent fault=[RPC Fault faultString="SOAP Response cannot be decoded. Raw response: " faultCode="DecodingError" faultDetail="null"] messageId=」52E31332-D231-3C4C-E2D1-0DDB1A1885D0″ type=」fault」 bubbles=false cancelable=true eventPhase=2]

+0

似乎鏈接到http://blogs.triarctic.com/browndblog/?p=122不起作用 – Nipuna 2012-10-18 10:06:12