Ah, i gotcha.  Totally possible.  I do the same thing except backwards
from .NET to Flex.

So you want to pass N number of People.  
People is an object that contains fields like first name, last name,
phone, ect...

I would create a class called person with these fields in it.  I would
add N number of people to an array Collection.  Then in my WS call i
would go ws.sendPeople(myPersonArrayCollection())

On the back end side have the web service accept a generic array of
objects.  I like to type them the same after I get them; so in .NET I
would have a duplicate person class.  Stepping through the Generic
array is not hard to do in .NET; just a few lines of code. I'm not
sure what language you are using though.

I have this written in a few applications.  If you need me to whip up
a full example with a .NET backend just say so.  I have taken much
more than I have given on this forum.  It's time to pay it forward :).
 I will be AFK until Tuesday so if you want an example try to respond
before 5pm or so tonight.

-Nate 


--- In [email protected], "discipl4" <[EMAIL PROTECTED]> wrote:
>
> Nate,
> 
> Thank you for the quick response!! :)
> 
> I did not know you could implement a WS call the way you do, very
> cool, although unless Im understanding it improperly, I dont think it
> will work for me.  Please correct me if I am misinterpreting how your
> way works.
> 
> You do ws.getMyFunction(firstName, lastName, city) .. for instance,
> and your webservice gets the data in an expected size and format,
> right?  It goes, param1 is the firstname, param2 is the lastname, and
> param3 is the city.  No definition involved but it is still finite.  
> 
> What I need to do is have a flexible structure in my xml to have an
> infinite amount tags inside certain blocks. 
> 
> So sometimes I might pass and xml that looks like this:
> 
> <person>
> <tag2>FirstName</tag2>
> <tag3>LastName</tag3>
> <tag4>San Diego</tag4>
> </person>
> 
> 
> and sometimes I need to send this:
> 
> <person>
> <tag2>FirstName</tag2>
> <tag3>LastName</tag3>
> <tag4>San Diego</tag4>
> <tag5>Chicago</tag5>
> <tag6>New York</tag6>
> </person>
> 
> If I pass in the parameters as you have, I have no way to denote the
> beginning and end of that section that contains 'n' number of elements.
> 
> Does that make sense?  I know it's hairy :)  I really want to keep the
> XML structure.  I think if I did it your way, I could pass in a ton of
> parameters as key/value pairs and build the xml on the other side...
> like.. ws.getMyFunction(firstname, Bill, lastname, Smith, city1,
> Chicago) ...  but man, then I have to dissect the nice XML object that
> Flex gives you to work with.
> 
> Thanks again for your time in hashing this out with me!!
> 
> Best,
> 
> - - Dan
> 
> 
> --- In [email protected], "Nate Pearson" <napearson99@> wrote:
> >
> > This is how I do it:
> > <mx:WebService id="ws" wsdl="http://myurl/service.asmx?WSDL"; 
> >    useProxy="false"  showBusyCursor="true">
> >     <mx:operation name="getMyFunction"
result="projectsHandler(event)"/>
> > 
> > </mx:WebService>
> > 
> > Then in action script I go ws.getMyFunction(param1, param2, param3).
> > 
> > You don't have to define your parameters in MXML.  If you don't, Flex
> > will let you send as many or as little parameters as you want.  I only
> > get an error if the amount of parameters that I send don't match the
> > type and number on the server side.
> > 
> > Hope this helps,
> > 
> > Nate
> > 
> > --- In [email protected], "discipl4" <discipl4@> wrote:
> > >
> > > Hi friends - I have been wrestling with a problem that I was hoping
> > > you could help me out with :)
> > > 
> > > I understand the premise of defining a WebService in Flex, with
> > > parameters and data, and sending the data over the wire to my WSDL. 
> > > However, I have a unique situation where I want to assemble a
dynamic
> > > XML file and send it over a WebService.  Unless you define a 1 to 1
> > > mapping of parameters in Flex to a WSDL, I cant find any way to make
> > > this work.
> > > 
> > > Example:  This works just fine as an operation on a webservice - 
> > > 
> > > <mx:operation name="SaveAction">
> > >  <mx:request>
> > >   <mx:myParameter>{someStringVariable}</mx:myParameter>
> > >  </mx:request>
> > > </mx:operation>
> > > 
> > > This is a 1 to 1 mapping of a parameter in Flex to my WSDL, which
> > > expects 1 value called myParameter.
> > > 
> > > However, if I pass in an XML object, SOAP will change all of my
< and
> > > > to &lt; and &gt; to avoid breaking the SOAP envelope.  I
understand
> > > the need to do this, but I just cant find a way around it.
> > > 
> > > Example:
> > > 
> > > var myXMLObject:XML = "<tag1><tag2></tag1></tag2>"
> > > 
> > > <mx:operation name="SaveAction">
> > >  <mx:request>
> > >   <mx:myParameter>{myXMLObject}</mx:myParameter>
> > >  </mx:request>
> > > </mx:operation>
> > > 
> > > The resulting packet across the wire will be one
> > > parameter(myparameter), with my XML as a string and all of the <
and >
> > > encoded to &gt...etc.  I have tried every hack I can think of and I
> > > cant get this to work.  Has anyone else had experience using a
> > > dynamically sized XML as the model for a webservice?
> > > 
> > > Any help is MUCH appreciated :)
> > > 
> > > Best Regards,
> > > 
> > > - - Dan
> > > 
> > > p.s. - I have come up with ways around this.. such as sending as an
> > > HTTPService with contentType="application/xml".. or decoding the
&gt,
> > > &lt on the webservice side.  Both of those work, but neither of
those
> > > fit within the webservice standards we currently apply here.  Thanks
> > > again.
> > >
> >
>


Reply via email to