Flex 3 和肥皂反应?

发布于 2024-08-27 09:37:05 字数 1481 浏览 8 评论 0原文

我想将数据插入 SQL Server,但我不断收到此错误

RPC错误faultString =“SOAP响应无法解码。原始响应:faultCode =“DecodingError”faultDetail =“null”]

我整天都可以获取数据,但为什么我无法输入任何数据?

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

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>   

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

街角卖回忆 2024-09-03 09:37:05

当您在 WS 中抛出异常并尝试在 Flex 中正确解析时,会出现此错误。请查看链接了解更多信息。

Flex 无法处理与 HTTP 500 状态相关的故障。在这种情况下你会得到一个 DecodingError 。这是因为当响应为 500 时,Flex 无法读取故障的详细信息。以下是 Flex 返回的实际故障。

[FaultEvent 错误=[RPC 错误错误字符串=“无法解码 SOAP 响应。原始响应:” failureCode=“DecodingError”faultDetail=“null”] messageId=”52E31332-D231-3C4C-E2D1-0DDB1A1885D0″ type=”fault” bubbles=false cancelable=true eventPhase=2]

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]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文