Flex 3 and soap response?

ⅰ亾dé卋堺 提交于 2019-12-20 05:46:12

问题


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 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>   

回答1:


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]



来源:https://stackoverflow.com/questions/2581799/flex-3-and-soap-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!