0

我正在处理一些旧的 Flex 项目(Flex 2.0.1 hotfix 2),我是 Flex 编程的新手。因此,我编写了用于访问一些 ASP.NET Web 服务的代码:

<?xml version="1.0" encoding="utf-8"?>

    [Bindable]
    public var users:ArrayOfUser;

    private function buttonClicked():void
    {
        mx.controls.Alert.show(dataService.wsdl);
        dataService.UserGetAll.send();/
    }

    public function dataHandler(event:ResultEvent):void
    {
        Alert.show("alo");
        var response:ResponseUsers = event.result as ResponseUsers;
        if (response.responseCode != ResponseCodes.SUCCESS)
        {
            mx.controls.Alert.show("Error: " + response.responseCode.toString());
            return;
        }
        users = response.users;

    }

]]>

<mx:Button label="Click me!" click="buttonClicked()"/>

这就是我从调试器中得到的:

WSDL loaded
Invoking SOAP operation UserGetAll
Encoding SOAP request envelope
Encoding SOAP request body
'A97A2DC1-AEDA-C594-45D2-1BA2B0F3B223' producer sending message '10681130-43E7-3DA7-34DD-1BA2B85545E3'
'direct_http_channel' channel sending message:
(mx.messaging.messages::SOAPMessage)#0
  body = "<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
    <tns:UserGetAll xmlns:tns="http://tempuri.org/"/>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>"
  clientId = "DirectHTTPChannel0"
  contentType = "text/xml; charset=utf-8"
  destination = "DefaultHTTP"
  headers = (Object)#1
  httpHeaders = (Object)#2
    SOAPAction = ""http://tempuri.org/UserGetAll""
  messageId = "10681130-43E7-3DA7-34DD-1BA2B85545E3"
  method = "POST"
  recordHeaders = false
  timestamp = 0
  timeToLive = 0
  url = "http://192.168.0.201:8123/Service.asmx"
'A97A2DC1-AEDA-C594-45D2-1BA2B0F3B223' producer acknowledge of '10681130-43E7-3DA7-34DD-1BA2B85545E3'.
Decoding SOAP response
Encoded SOAP response <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><UserGetAllResponse xmlns="http://tempuri.org/"><UserGetAllResult><ResponseCode>Success</ResponseCode><Users><User><Id>1</Id><Name>test</Name><Key>testKey</Key><IsActive>true</IsActive><Name>Petar i Sofija</Name><Key>123789</Key><IsActive>true</IsActive></User></Users></UserGetAllResult></UserGetAllResponse></soap:Body></soap:Envelope>
Decoding SOAP response envelope
Decoding SOAP response body

最后我得到这个错误“错误 #1006:getAttributeByQName 不是一个函数。” . 如您所见,我从 Web 服务获得了正确的响应,但dataHandler从未调用过函数。

谁能帮帮我?

谢谢,德韦蒂·普特尼克

4

1 回答 1

0

通过安装 Hotfix 3,我解决了这个问题,因为它从未存在过。

于 2010-06-09T11:08:50.817 回答