Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to parse SOAP response using FLEX
    text
    copied!<p>My Flex application properly call a web service but it does not populate the drop down box.</p> <p>Based on my researches the problem is with the namespaces, but still not sure how to solve it.</p> <p>Once I run the application the drop down box is empty. </p> <p>My java code</p> <pre><code>package com.Services; import com.classes.*; import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.WebResult; @WebService (name="Hellos", targetNamespace="http://localhost:8081/Mywebservice2/services/Hellos") public class Hellos { @WebMethod public @WebResult (name="customers",partName="customers") Customer[] mycustomers() { System.out.println("Retriving customers...."); Customer[] cus = new Customer[2]; cus[0] = new Customer("Jack", 28); cus[1] = new Customer("Ben", 29); return cus; } } </code></pre> <p>The network monitor feature of the flex application shows the response is as following</p> <pre><code>HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=utf-8 Transfer-Encoding: chunked Date: Thu, 10 Jan 2013 04:23:55 GMT &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;mycustomersResponse xmlns="http://Services.com"&gt; &lt;mycustomersReturn&gt; &lt;age&gt;28&lt;/age&gt; &lt;name&gt;Jack&lt;/name&gt; &lt;/mycustomersReturn&gt; &lt;mycustomersReturn&gt; &lt;age&gt;29&lt;/age&gt; &lt;name&gt;Ben&lt;/name&gt; &lt;/mycustomersReturn&gt; &lt;/mycustomersResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p>my flex code is as following</p> <pre><code>&lt;fx:Script&gt; &lt;![CDATA[ import mx.controls.Alert; import mx.events.FlexEvent; protected function dropDownList2_creationCompleteHandler(event:FlexEvent):void { mycustomersResult2.token = hellos.mycustomers(); } ]]&gt; &lt;/fx:Script&gt; &lt;fx:Declarations&gt; &lt;hellos:Hellos id="hellos" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/&gt; &lt;s:CallResponder id="mycustomersResult2"/&gt; &lt;/fx:Declarations&gt; &lt;s:FormItem label="Label"&gt; &lt;s:DropDownList id="dropDownList2" creationComplete="dropDownList2_creationCompleteHandler(event)" labelField="age"&gt; &lt;s:AsyncListView list="{mycustomersResult2.lastResult}"/&gt; &lt;/s:DropDownList&gt; &lt;/s:FormItem&gt; </code></pre> <p><strong>When I change</strong> </p> <pre><code>&lt;s:AsyncListView list="{mycustomersResult2.lastResult}"/&gt; </code></pre> <p><strong>to</strong> </p> <pre><code>&lt;s:AsyncListView list=" {mycustomersResult2.lastResult.mycustomersResponse.mycustomersReturn}"/&gt; </code></pre> <p>it gives the following error </p> <pre><code>Error: Unknown Property: 'mycustomersResponse'. at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:870] at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:338] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.binding::Watcher/wrapUpdate()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\Watcher.as:192] at mx.binding::PropertyWatcher/updateParent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:239] at mx.binding::Watcher/updateChildren()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\Watcher.as:138] at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:347] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.binding::Watcher/wrapUpdate()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\Watcher.as:192] at mx.binding::PropertyWatcher/eventHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:375] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.rpc::CallResponder/set lastResult() at mx.rpc::CallResponder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\CallResponder.as:120] at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:239] at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:207] at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:244] at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318] at mx.rpc::Responder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\Responder.as:56] at mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84] at DirectHTTPMessageResponder/completeHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:451] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload