tags:

views:

27

answers:

2

I have a Flex service defined like so:

    <mx:operation name="postTableDetails" resultFormat="e4x" result="event.token.resultHandler(event);" fault="event.token.faultHandler(event);">
        <mx:request>
            <catalog></catalog>
            <schema></schema>
            <table></table>
            <details></details>

Anyway, I'm basically having trouble resetting the argument to look more like:

<details create_time="x" table_type="x">
    <column name="c1" datatype="INT" />
    ...
</details>

In my AS function that eventually loads the arguments and calls the service, I'm doing something like this:

var o:AbstractOperation = service.getOperation("postTableDetails");
o.arguments.catalog = catalog;
...
 o.arguments.details = new XML(details);

If I trace my "details" var and then o.arguments.details after, both are the valid XML I expect. But the actual request that goes through truncates it to:

<details><column /></details>

I've had success with simple requests where I just populate something like schema with a string, but this more complicated one has me stumped right now.

A: 

Hi Kevin,

First try putting the following in your service

contentType="application/xml"

and then also if it doesn't workout, then better to have

request="{details}"

Try it out and lemme know.

Ravz
Hi Ravz, thanks for the help. Unfortunately contentType is apparently not valid at runtime, and binding with XML doesn't really work. I guess I could probably hack it together with some globals, but I'd like to avoid it.
Kevin
Hi Kevin, I have used binding with XML. For me it works fine. However, I have been using HTTPService. I'm not sure if it works with operation.
Ravz
A: 

So I got it working using Ravz's suggestion in the end. I changed the service definition to just be:

    <mx:operation id="postTableDetails" name="postTableDetails" resultFormat="e4x" result="event.token.resultHandler(event);" fault="event.token.faultHandler(event);">
    </mx:operation>

(Added the id and removed the request.) Then in the delegate, I assign the arguments and such with:

service.postTableDetails.request = XMLList(
           "<ns0:postTableDetails xmlns:ns0=\"http://nslinkfromwsdl/\"&gt;" +
           "<catalog>"+cat+"</catalog>" +
           "<schema>"+schema+"</schema>" +
           "<table>" + table + "</table>" +
           details +
           "</ns0:postTableDetails>"
           );

And this makes it work correctly. I'd like to not have to hardcode that link in there, but I can figure that out another day!

Kevin