With the literal request format <mx:request format="xml"> instead of
passing in the object as the parameter and having it serialized you
write the XML that the service would expect.  So since you know what the
XML should look like going across the wire you just fill that in instead
of the serializer doing the wrong thing like we're seeing.

I did some searching and I found the bug and it's marked as fixed in
1.5.  So in reading your code a little further I'm not sure I can tell
how your WebService function is supposed to work.  You said that
everything was passed correctly if you specified a single range.  Does
that mean that you passed an array of 1, or did you just pass the range
object?  Is it possible that you declared two functions in your Java
side for the WebService, one that takes an array and one that doesn't?
If that's the case we may have a problem because AS doesn't support
method overloading so it may pick the wrong method.

Not too much help here I know, if we can see the WSDL we may be able to
learn a little more.

Matt

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Pablo Apanasionek
Sent: Friday, February 10, 2006 4:48 AM
To: [email protected]
Subject: RE: [flexcoders] Array serialization for Webservice

Matt,

Thanks for your reply.

Could you explain me a bit of how this 'literal request format' would
work?

Thanks in advance,
Pablo Apanasionek

-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En
nombre de Matt Chotin
Enviado el: Viernes, 10 de Febrero de 2006 04:36
Para: [email protected]
Asunto: RE: [flexcoders] Array serialization for Webservice

Unfortunately I think this may be a known bug.  I believe you're going
to need to do a literal request format and pass the information in XML
yourself to make it work.  I don't remember if we may have fixed this in
a hotfix, if you have a support contract you may want to ask your rep.

Matt

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Pablo Apanasionek
Sent: Thursday, February 09, 2006 11:03 AM
To: [email protected]
Subject: [flexcoders] Array serialization for Webservice

I tried many things without results, so I decided to ask for help.

I'm using Flex 1.5 and some Java Webservices. I have an object that is
passed as a parameter to a webservice. The Object goes something like
this:

SomeObject(code:String, ranges:Array)

The "ranges" array contains 1 or more instances of some other object,
which has a String and two Numbers.

So far, so good. And here comes the problem:

When I complete my paramObject with a code and ONE range in the ranges
array (which I decided to declare as Object = code:AAA,
ranges:(D,200,300)), it serializes like this:

<code>AAA</code>
<ranges>
  <scope>X</scope>
  <from>200</from>
  <to>300</to>
<ranges>

Its values are passed like this:

someService.addType.request.code = 'AAA';
someService.addType.request.ranges.scope = 'X';
someService.addType.request.ranges.from = 200;
someService.addType.request.ranges.to = 300;

This format posts well to the webservice, and it results OK.

But, if I add a range (in the array), so it holds two ranges, I step
into two problems:

1) If I stick to declaring "ranges" as an Object, I can't add another
instance of it.

2) If I convert "ranges" into an Array, and add the two complete
objects, although the Flex Network Monitor and Trace Panel show it
right, it gets serialized like this:

<code>AAA</code>
<ranges/>
<item>
  <scope>X</scope>
  <from>200</from>
  <to>300</to>
<item>
<item>
  <scope>Z</scope>
  <from>400</from>
  <to>500</to>
<item>

Resulting in a fault event of the webservice, because of the
unrecognized property "item".

Is there a way to change the serialization of array (as I would need to
name each item as "ranges" and not as "item") or some other way to fix
this?

Thanks in advance,
Pablo Apanasionek





--
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



 




--
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



 




--
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



 





--
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/
 



Reply via email to