Expand my Community achievements bar.

unable to bind to property

Avatar

Level 1
Hi.

I'm trying to use a webservice within my flex application
that returns an object.

I get this error: warning: unable to bind to property 'DD' on
class 'String' (class is not an IEventDispatcher)

I'm using this code, and I have other methods in the same
webservice that works, but they only returns one String.

<mx:WebService id="getTest" wsdl="
http://localhost:6060/webservice/getTest?WSDL">

<mx:operation name="getWebObject"
resultFormat="object"></mx:operation>

<mx:operation name="sayHello"></mx:operation>

</mx:WebService>

Then I call the method like this:

[webService id].[operation name].lastResult.[name of the
Object from the wsdl file].[name of the String that i need from the
wsdl] as: getTest.getWebObject.lastResult.ObjectTest.DD



The Object description in the wsdl file looks like this:

<complexType name="ObjectTest">

<sequence>

<element name="DD" type="string" />

<element name="DR" type="string" />

</sequence>

</complexType>



Can anyone please tell me how I can bind the property to the
object correct?

I allso need to use another method that returns an ArrayList
of the same object?

Is this possible?
1 Reply

Avatar

Level 3
Can you show me the usage of
getTest.getWebObject.lastResult.ObjectTest.DD in the binding
statement? Note that this syntax does not call the method, it just
allows access to the lastResult of a particular operation (which
you either call like getTest.getWebObject(param1, param2) or
getTest.getWebObject.send() ).



Instead of using getWebObject.lastResult, can you write an
event handler for the result event on each operation and then
programmatically update a bindable variable or change whatever is
listening for the ObjectTest.DD property?



...

<mx:operation name="getWebObject" resultFormat="object"
result="handleGetWebObject(event)" />

...



<mx:Script>

<![CDATA[

private function handleGetWebObject(event:ResultEvent):void

{

var result:Object = event.result;

// Do something with the result as needed, such as updating
values

}

]]>

</mx:Script>



WebServices Arrays will become mx.collections.ArrayCollection
instances by default, which are bindable - however I'd need to see
what you're planning on doing in MXML/AS first.