The header name you used was "contentType", which would not be recognized by the
server as the HTTP content type header.
Try this line instead
customeraction.setHeader("Content-Type", "application/xml");
I wrote a little .jsp to check what the incoming content type header
in the request is
on the backend service:
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<value header="Content-Type"><%
// Return the specified HTTP Request header as the <value> to the
client can examine it
response.setContentType("text/xml");
out.print("<![CDATA[" + request.getHeader("Content-Type") + "]]>");
%></value>
And when I retrieve data from that URL, with your script, I see the
content type
set properly to
<customeraction><value
header="Content-Type">application/xml</value></customeraction>ยป
On 9/3/07, togawa manabu <[EMAIL PROTECTED]> wrote:
> Thanks,
>
> I'm using 4.0.3 both DHTML and SWF compile, and proxied mode.
>
> this is small test app.
>
> -----rails side -----
> (create REST-full app just in few command)
>
> >rails lzxtest -d sqlite3
> >cd lzxtest
> >script/generate scaffold_resource
> customer :first_name:string :last_name:string
> >rake db:migrate
> >script/server
>
> ----lzx side ---
>
> <canvas>
> <attribute name="baseurl" value="http://127.0.0.1:3000"
> type="string" />
> <dataset name="customeraction" ondata="Debug.write(this)" />
>
> <button text="createdata" onclick="canvas.request('post', '/
> customers.xml')" />
>
> <method name="request" args="method, url"><![CDATA[
> var p = new LzParam();
>
> switch(method){
> case "get":
> customeraction.setQueryType("get");
> break;
> case "post":
> customeraction.setQueryType("post");
> p.addValue("lzpostbody", "<customer><first-name>firstname</
> first-name><last-name>lastname</last-name></customer>");
> break;
> case "delete":
> customeraction.setQueryType("post");
> p.addValue("_method", "delete");
> break;
> case "put":
> customeraction.setQueryType("post");
> p.addValue("_method", "put");
> break;
> }
> p.addValue("format", "xml");
>
> customeraction.setSrc(this.baseurl + url);
> customeraction.setQueryString(p);
> customeraction.setHeader("contentType", "application/xml");
> customeraction.doRequest();
> ]]></method>
> </canvas>
>
> -------------------------------------
>
> Thanks!
>
> -manabu togawa
>
> On 2007/09/04, at 8:59, Henry Minsky wrote:
>
> > Can you tell me which version of openlaszlo you're using, which
> > runtime (SWF or DHTML),and if are you running SOLO or proxied?
> >
> > I need to look at the data loader for the conditions you are using,
> > and see if the content-type can be modified for POST requests.
> >
> > Thanks,
> >
> > Henry
> >
> >
> > On 9/3/07, togawa manabu <[EMAIL PROTECTED]> wrote:
> >> Hi,
> >>
> >> I'm playing with Rails1.2.3 it contains a script "scaffold_resource"
> >> it generates RESTfully controller, model and view.
> >> you can get/put/delete/post XML data with simple URL and HTTP-
> >> protocol. I think it perfectly match with OpenLaszlo.
> >>
> >> Rails also has capability of XML-data to rails-params parser when
> >> content-type is "application/xml".
> >> But Dataset's POST content-type is "application/x-www-form-
> >> urlencoded".
> >>
> >> I tried
> >>
> >> ds.setQueryType("post");
> >> ds.setHeader("contentType", "application/xml");
> >> ds.doRequest();
> >>
> >> But the contentType is still "application/x-www-form-urlencoded".
> >>
> >> Is it possible to change the content-type with POST request??
> >> Thank you.
> >>
> >> -manabu togawa
> >>
> >
> >
> > --
> > Henry Minsky
> > Software Architect
> > [EMAIL PROTECTED]
>
>
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]