【发布时间】:2009-10-16 16:35:08
【问题描述】:
更新:问题与 命名空间或弹性。我的 网络服务正在返回包装好的 xml。在质疑 java 之前,我一直在责怪我最不熟悉的语言......
我有一个基本的肥皂网络服务,我无法从 flex 中读取结果。
我是一名可靠的 Java 程序员,只是想了解 adobe flex。
在documentation我应该可以使用“WebService”以e4x格式返回结果。
<mx:WebService id="CurrentLayersWS" wsdl="http://localhost:8080/myproject/ws/myservice.wsdl" showBusyCursor="true" result="updateSelected(event)" fault="Alert.show(event.fault.faultString), 'Error'">
<mx:operation name="publisher" resultFormat="e4x">
<mx:request>
<publisherRequest>
<getConfiguration/>
</publisherRequest>
</mx:request>
</mx:operation>
</mx:WebService>
如您所见,响应由函数“updateSelected”处理,如下所示:
private function updateSelected(event:ResultEvent):void {
var responseXml:XML = XML(event.result);
不幸的是,事件对象似乎嵌套和编码奇怪。当我使用调试器时,我看到 responseXml 是 XMLList 类型,其中包含一个 XML 类型的元素(在索引 0 处),它只包含以下 xml:
<sch:temp xmlns:sch="http://www.mycompany.co.uk/myproject/schemas" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:publisherResponse xmlns:ns2="http://www.mycompany.co.uk/myproject/schemas">
<getConfigurationResponse>
<configuration>
...etc
为什么我的 xml 嵌套在具有根节点“sch:temp”的文档中?
【问题讨论】:
-
我认为问题出在 wsdl 上。在浏览器中打开 localhost:8080/myproject/ws/myservice.wsdl 以查看内容 - 使用查看源代码查看确切内容。
标签: xml apache-flex web-services actionscript mxml