Well, the part that I dont understand is why I have to create an
Object for it to preserve the name and structure once it gets
converted. My original thought was to do something like this:
args.SelectedPlans = new Array();
args.SelectedPlans.push({PlanNumber: 12345});
args.SelectedPlans.push({PlanNumber: 56789});
but the SelectedPlans name is not preserved in that case. It ends up
as two anonymous objects on the level that the array was created on,
rather than being nested inside of it.
If there is truly no way to accomplish this type of structure it makes
creating WS calls, and especially your ServiceLocator, in AS pretty
pointless.
Adobe, please say it ain't so...
Ben
--- In [email protected], "Joost Nuijten" <[EMAIL PROTECTED]> wrote:
>
> I'm not sure if this is possible in any language (correct me if I'm
wrong).
> Normally, you would create an array of objects (address object
mentioned in
> Franck's example) or just an array with ID's.
>
> Objects are always translated to collections like HashMap's and
arrays (or
> ArrayCollections) to arrays.
> All those collections are based on unique identifiers (in AS, Java
or .NET).
> Of course, it is possible to create a custom collection that supports
> redundant indentifiers, but internally you still have to use unique
ID's.
> And the SOAP parser falls back to the default collections anyway.
>
> _____
>
> Van: [email protected] [mailto:[EMAIL PROTECTED]
Namens
> ben.clinkinbeard
> Verzonden: maandag 7 augustus 2006 22:16
> Aan: [email protected]
> Onderwerp: [flexcoders] Re: Web Service arguments in AS - how do you
create
> repeated children?
>
>
>
> "Would it be acceptable for you if your XML would look like this?"
> Unfortunately not :(
>
> Does anyone know if there is an explanation anywhere on how the
> compiler converts AS structures into SOAP format? Currently, it all
> seems pretty mysterious. Anyone from Adobe have any insight?
>
> Thanks,
> Ben
>
> --- In [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com>
ups.com,
> "Franck de Bruijn"
> <franck.de.bruijn@> wrote:
> >
> > 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:flexcoders%40yahoogroups.com>
ups.com
> [mailto:[EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com>
ups.com]
> On
> > Behalf Of ben.clinkinbeard
> > Sent: Monday, August 07, 2006 8:30 PM
> > To: [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com
> > 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] <mailto:flexcoders%40yahoogroups.com>
> 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] <mailto:flexcoders%40yahoogroups.com>
> ups.com
> > [mailto:[EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com>
> ups.com]
> > On
> > > Behalf Of ben.clinkinbeard
> > > Sent: Monday, August 07, 2006 3:11 PM
> > > To: [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com>
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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/