UPDATE阅读E4X格式的XML:这个问题是不是与 命名空间或Flex做的。我的 webservice正在返回包装 xml。我在责怪java之前最少遇到的语言...问题使用Flex从SOAP Web服务
我有一个基本的soap webservice,我无法从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是含有一个元素(索引0)的XML类型,其只包含下面的XML类型为XMLList:
<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。在浏览器中打开http:// localhost:8080/myproject/ws/myservice.wsdl以查看内容 - 使用查看源查看确切内容。 – Amarghosh 2009-10-16 16:42:46