Hi Ben,

 

I think I am starting to understand what you mean. I don’t have the environment up-and-running to really test ...

 

In my case, the XML will probably be something like:

<customer>

  <addresses>

     <street>1</street>

     ...

  </addresses>

  <addresses>

     <street>2</street>

     ...

  </addresses>

</customer>

 

I’m sure that Flex is doing the right thing there, since I am basing some of my webservices on this kind of structures and all is working fine.

 

In your case you have a list of simple strings/numbers, while my list is of objects (having their own attributes) ...

 

Would it be acceptable for you if your XML would look like this?

 

<SelectedPlans>
  <PlanNumber>

    <Value>12345</Value>

  </PlanNumber>
  <PlanNumber>

    <Value>56789</Value>

  </PlanNumber>

</SelectedPlans>

Then, you could make a PlanNumber action script object with a property Value in it. The SelectedPlans object would have an array having PlanNumber objects ...

 

Cheers,

Franck

 


From: [email protected] [mailto:[email protected]] On Behalf Of ben.clinkinbeard
Sent: Monday, August 07, 2006 8:30 PM
To: [email protected]
Subject: [flexcoders] Re: Web Service arguments in AS - how do you create repeated children?

 

Hi Franck,

Thanks for the response. I am still having the same problem though,
which is that I end up with a generic 'item' tag or property being
created somewhere along the way. I am beginning to think that this
structure cannot be created in AS as it seems like I would need an
object with 2 properties named PlanNumber.

I tried using an object with a PlanNumber property of type Array, and
then stuffing the values into that, but that turns into

<SelectedPlans xmlns="">
<item xmlns="">78167</item>
<item xmlns="">78173</item>
</SelectedPlans>

Is there a way to create a default property of an object or something?
Does valueOf() still exist?

Ben

--- In [EMAIL PROTECTED]ups.com, "Franck de Bruijn"
<franck.de.bruijn@...> wrote:
>
> Hi Ben,
>
>
>
> I do the following to achieve this.
>
>
>
> Let's say I have a Customer who can have multiple Address objects.
Compare
> Customer with your SelectedPlans and Address with PlanNumber.
>
>
>
> My Customer AS class looks like this (boring parts omitted)
>
>
>
> package model {
>
>
>
> <your imports ...>
>
>
>
> public class Customer
>
> {
>
> <your other attributes>
>
> public var addresses:Array = new Array();
>
>
>
> <and the rest ...
>
>
>
> The Address AS class is nothing more than this:
>
>
>
> package model {
>
>
>
> <your imports ...>
>
>
>
> public class Address {
>
> public var street:String;
>
> public var houseNumber:int = 0;
>
>
>
> <... you get the idea>
>
>
>
> To store multiple Address objects into the Customer object, you just
fill
> the array 'addresses' with Address objects.
>
>
>
> You can now throw the entire Customer object as single argument into
your
> webservice call. Flex will unmarshal the array correctly and
generate the
> XML as you describe below.
>
>
>
> Hope this helps,
>
> Cheers,
>
> Franck
>
>
>
>
>
> _____
>
> From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of ben.clinkinbeard
> Sent: Monday, August 07, 2006 3:11 PM
> To: [EMAIL PROTECTED]ups.com
> Subject: [flexcoders] Web Service arguments in AS - how do you create
> repeated children?
>
>
>
> Hello, I am sending arguments to my SOAP method, but can't figure out
> how to do repeated children in AS. For example, part of my call looks
> like this in XML:
>
> <SelectedPlans>
> <PlanNumber>12345</PlanNumber>
> <PlanNumber>56789</PlanNumber>
> </SelectedPlans>
>
> I cannot figure out how to create this structure in AS. It seems that
> I have to use an Object (args.SelectedPlans = new Object();) in order
> for the name to be preserved during the conversion to XML, but objects
> obviously can't have 2 properties with the same name.
>
> Does anyone know how to do this?
>
> Thanks,
> Ben
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to