开发者

Flex 3 and soap response?

I want to insert data into a SQL Server, but I keep getting this error

RPC Fault faultString="SOAP Response cannot be decoded. Raw response:faultCode="DecodingError" faultDetail="null"]

I can get data all day, but why can't I input any?

<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 GetEmplo开发者_运维问答yees(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>   


This error comes when you are throwing an exception in WS and trying to correctly parse in Flex. Check this link for more info.

Flex cannot handle faults that are associated with an HTTP 500 status. You will get a DecodingError in this case. This stems from Flex not being able to read the details of a fault when the response is 500. Here is the actual Fault Flex returns.

[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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜