代码之家  ›  专栏  ›  技术社区  ›  matt burns

使用flex从SOAP Web服务读取e4x格式的XML时出现问题

  •  1
  • matt burns  · 技术社区  · 16 年前

    更新 命名空间或flex。我的

    我有一个基本的soap网络服务,在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>
    

    private function updateSelected(event:ResultEvent):void {
        var responseXml:XML = XML(event.result);
    

    <sch:temp xmlns:sch="http://www.mycompany.co.uk/myproject/schemas" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
    &lt;ns2:publisherResponse xmlns:ns2="http://www.mycompany.co.uk/myproject/schemas"&gt;
        &lt;getConfigurationResponse&gt;
            &lt;configuration&gt;
            ...etc
    

    2 回复  |  直到 16 年前
        1
  •  0
  •   Eric Belair    16 年前

    这是一个命名空间。我不知道为什么会有它,但是,在我们开始消费后,我不得不处理类似的事情。NET Web服务在我们的一个Flex应用程序中。我只需在ActionScript中引用命名空间:

    <mx:Script>
        <![CDATA[
            private namespace schNamespace = "http://www.mycompany.co.uk/myproject/schemas";
    
            use namespace schNamespace;
        ]]>
    </mx:Script>
    

    试试看……它可能会奏效。

        2
  •  0
  •   matt burns    16 年前

    推荐文章