Here are some of the things I've tried. Note all the different effects
for what appears to be equivalent code.

<canvas>
    <script>
        
System.security.loadPolicyFile("https://rest.mydomain.com/crossdomain.xml";);
    </script>
    <!-- NOTE: src is needed in order to get nsprefix to work -->
    <dataset name="dssend" proxied="false" nsprefix="true" src="https:"/>
    <node name="datactl">
        <method name="send">
            var ds = dssend;
            var x = '<![CDATA[<foo>bar</foo>]]>';

            ds.setAttribute('src', 'https://rest.mydomain.com/foos');
            ds.setQueryParams(null); // clear query params
            ds.setAttribute('querytype', 'POST');

            // Sends "sid=abcdefg" as body, very odd. x is NOT sent.
            // ds.setQueryParam('sid', 'abcdefg');
            // ds.setPostBody(x);

            // Sends encoded x, odd again.
            // BUT if the above ds.setQueryParams(null) is
            // removed it is sent as is (i.e. correctly).
            // ds.setPostBody(x);

            // Sends correct x (even with ds.setQueryParams(null)).
            // ds.setQueryParam('lzpostbody', x);

            // Sends correct x, but no sid in query params.
            ds.setQueryParam('sid', 'abcdefg');
            ds.setQueryParam('lzpostbody', x);

            ds.doRequest();
        </method>
    </node>
    <button text="Send">
        <handler name="onclick" args="v">datactl.send();</handler>
    </button>
</canvas>

Running:
laszlo 4.2.b2, compiled for swf8
Firefox 2.0.0.16 on CentOS 5.0 (2.6.18-53.el5) x86_64
Flash player LNX 9,0,124,0

On Wed, Dec 3, 2008 at 2:32 PM, Henry Minsky <[EMAIL PROTECTED]> wrote:
> On Wed, Dec 3, 2008 at 5:30 PM, Greg Denton <[EMAIL PROTECTED]> wrote:
>> I just want to touch base on the SLOLO REST support for 4.2. This may
>> be more of a swf question but if anyone could comment, it would be
>> appreciated. (We are getting closer to a release and need to know
>> whether/how to hack our backend service to do workarounds. I almost
>> had a workaround for current 4.2b2 swf8 code but then discovered that
>> query params could not be set when a body is given, argh!)
>
>
> Are you sure that query params cannot be set when there is a post
> body? I could have sworn
> we specifically fixed that to work. Can you send me a test case?
>
>
>
>>
>> Review of a completely transparent REST/HTTP interface:
>>
>> 1. All methods supported, PUT/DELETE in addition to GET/POST.
>> 2. For all method types, independently set:
>>    (a) request headers,
>>    (b) query params,
>>    (c) body/content.
>> 3. For all responses (all method types), whether status OK or not, get:
>>    (a) status,
>>    (b) response headers,
>>    (c) body/content (parse returned XML).
>>
>> (The odd thing is that this is the basic HTTP protocol and, in some
>> ways, is simpler to implement than constraining things as is currently
>> done.)
>>
>> I presume that this would only be available on swf9/DHTML, right?
>>
>> Thanks.
>>
>> On Mon, Aug 11, 2008 at 10:06 AM, Greg Denton <[EMAIL PROTECTED]> wrote:
>>> Thanks for the update and all the good work. My brief testing with
>>> 4.2alpha didn't go so well, I'll wait for the beta to be more
>>> thorough.
>>>
>>> Openlaszlo has such a good fundamental design for rapid application
>>> development that to hobble easily programmable communication with
>>> backend services over such a simple, open standard would be a loss.
>>>
>>> On Fri, Aug 8, 2008 at 5:49 PM, Henry Minsky <[EMAIL PROTECTED]> wrote:
>>>>
>>>> A matrix is a good idea!
>>>>
>>>> Here is my understanding of what should work for SOLO http operations
>>>>
>>>>                        SWF8                 SWF9             DHTML
>>>> GET                    X                    X                X
>>>> POST                   X*                   X                X
>>>> PUT                                         X                X
>>>> DELETE                                      X                X
>>>>
>>>> * in swf8, you can set the postbody to be a valid XML document, and that
>>>> content
>>>> will be posted verbatim.  If you make something which is not valid XML, it
>>>> will be posted
>>>> as a string which is XML-escaped.
>>>>
>>>> If you see different behavior, please post a note to me or file a bug 
>>>> report
>>>> with the details.
>>>>
>>>>
>>>> On Fri, Aug 8, 2008 at 5:42 PM, Greg Denton <[EMAIL PROTECTED]> wrote:
>>>>> Can anyone summarize the SOLO REST support that is (alpha)/will be
>>>>> (release) working in 4.2? A matrix would be nice :-). In the wiki even
>>>>> nicer so we wouldn't have to search so much.
>>>>> http://wiki.openlaszlo.org/Laszlo_on_REST looks like only proposals,
>>>>> need to track current status.
>>>>>
>>>>>               swf8, swf9, dhtml
>>>>> POST
>>>>> PUT
>>>>> DELETE
>>>>>
>>>>> request set headers?
>>>>> response get headers, status code?
>>>>> cross-domain issues?
>>>>>
>>>>> I assume no problems with GET (other than maybe confusion with
>>>>> setQueryParams, LPP-6586).
>>>>>
>>>>> POST body looks like it Is fixed in 4.2beta:
>>>>> http://www.openlaszlo.org/jira/browse/LPP-6683
>>>>>
>>>>> Might want to close this (or mark duplicate?):
>>>>> http://www.openlaszlo.org/jira/browse/LPP-2195
>>>>>
>>>>> Pretty good overview of past problems (close and/or add comment, link to
>>>>> wiki?):
>>>>> http://www.openlaszlo.org/jira/browse/LPP-1045
>>>>>
>>>>> Thanks a lot.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Henry Minsky
>>>> Software Architect
>>>> [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>>
>>>
>>
>
>
>
> --
> Henry Minsky
> Software Architect
> [EMAIL PROTECTED]
>

Reply via email to