What happens if you sen the xml as a string explicitly, and then parse
it into a dom on the server?
<mx:operation name="SaveAction">
<mx:request>
<mx:myParameter>{myXMLObject.toXMLString()}</mx:myParameter>
</mx:request>
</mx:operation>
Tracy
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of discipl4
Sent: Wednesday, May 16, 2007 6:39 PM
To: [email protected]
Subject: [flexcoders] Re: WebService sending dynamic XML - problem
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] <mailto:flexcoders%40yahoogroups.com>
, "Nate Pearson" <[EMAIL PROTECTED]> wrote:
>
> This is how I do it:
> <mx:WebService id="ws" wsdl="http://myurl/service.asmx?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]
<mailto:flexcoders%40yahoogroups.com> , "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 < and > 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 >...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
>,
> > < on the webservice side. Both of those work, but neither of those
> > fit within the webservice standards we currently apply here. Thanks
> > again.
> >
>