Himi
11-14-2008, 06:33 PM
Hi
I have an application in which the the client gets sopme XML from the server, modifies it and has to write this changed XML back to a file on the server.
The client side is on flex and server is a servlet. So i made an XML object in the flex code which i am passing to the server but i dont understand how to retrieve it in the servlet code.
the flex code is
private function sendWrite() : void
{
var http:HTTPService = new HTTPService();
http.url = ROOT_URL;
http.resultFormat = "text";
http.method="post";
http.contentType="application/xml";
http.request=xmlObj; // This is the xml object that needs to be passed.
http.addEventListener(ResultEvent.RESULT, onResult);
http.addEventListener(FaultEvent.FAULT, onFault);
http.send();
}
My servlet code is :
public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// I need help here . How do i retrieve the xml object?
// The getParameters method only returns strings.. Is there a way to get object ?
}
btw,
The xml im sending from flex has the format :
<A type="main" >
<B type="sub" value="1" />
<B type="sub" value="2" />
<B type="sub" value="3" />
</A>
Thanks,
Himi
I have an application in which the the client gets sopme XML from the server, modifies it and has to write this changed XML back to a file on the server.
The client side is on flex and server is a servlet. So i made an XML object in the flex code which i am passing to the server but i dont understand how to retrieve it in the servlet code.
the flex code is
private function sendWrite() : void
{
var http:HTTPService = new HTTPService();
http.url = ROOT_URL;
http.resultFormat = "text";
http.method="post";
http.contentType="application/xml";
http.request=xmlObj; // This is the xml object that needs to be passed.
http.addEventListener(ResultEvent.RESULT, onResult);
http.addEventListener(FaultEvent.FAULT, onFault);
http.send();
}
My servlet code is :
public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// I need help here . How do i retrieve the xml object?
// The getParameters method only returns strings.. Is there a way to get object ?
}
btw,
The xml im sending from flex has the format :
<A type="main" >
<B type="sub" value="1" />
<B type="sub" value="2" />
<B type="sub" value="3" />
</A>
Thanks,
Himi