关于 apache flex:如何将类型为 ObjectProxy 的 WebService 结果转换为 XML? | 珊瑚贝

How do I convert WebService result typed as ObjectProxy to XML?


我有一个在 SOAP 响应中返回 XML 的 WebService:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?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>
        <GetConfigResponse xmlns=“Web.Services”>
            <GetConfigResult>
                <Configuration xmlns=“”>
                    <Stuff>False</Stuff>
                    <MoreStuff>
                        <Report_Format>PDF</Report_Format>
                        <Report_Sections>
                            <Report_Section>
                                <idNmb>1</idNmb>
                                <name>Report 1</name>
                                <isDefault>true</isDefault>
                                <isVisible>true</isVisible>
                            </Report_Section>
                            <Report_Section>
                                <idNmb>2</idNmb>
                                <name>Report 2</name>
                                <isDefault>false</isDefault>
                                <isVisible>true</isVisible>
                            </Report_Section>
                        </Report_Sections>
                    </MoreStuff>
                </Configuration>
            </GetConfigResult>
        </GetConfigResponse>
    </soap:Body>
</soap:Envelope>

当我调用这个 WebService 时,Flex 调试器显示 ResultEvent.result 的类型是”ObjectProxy”。当我尝试将此值转换为 XML 时,它会跟踪为”[object Object]”,并且我无法访问 XML 节点。对于我调用的大多数其他 Web 服务,ResultEvent.result 的类型为”Array”,并且可以毫无问题地转换为 XML。

如何将此结果存储为 XML?


将您的请求/操作的 resultFormat 设置为 “e4x”,它将返回一个 XML 对象,而不是将结果转换为 ObjectProxy。

  • 我在我的基础 WebService 类中使用 AbstractOperation 作为操作类型。 AbstractOperation 类没有 resultFormat。我将尝试将其更改为 mx.rpc.soap.Operation 并查看它是否仍能正常工作。谢谢你。
  • 有效!谢谢。很明显,但我看不到。谢谢ianmjones(和stackoverflow)。
  • 这破坏了我的另一个 WebService 调用 – 它没有正确处理命名空间 – 所以我必须将 resultFormat 更改为 “xml” 才能使其全面工作。


来源:https://www.codenong.com/923132/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_8838.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?