views:

222

answers:

3

Hi I am developing an application with Flex for the GUI and Restlet for the webservices. I have a strange problem. I put my XML as a property on a generic object, and send it as part of a POST request. But in the Restlet webservice, this XML is irretrievable. How do I retrieve it? I tried initialising the received Representation object to a DomRepresentation, but thats not working. If I put the received Representation object into a Form object, then getFirstValue is returning that XML as a string!

A: 

I noticed that the contentType of the HTTPService was application/www-form-encoded so I set it to application/xml and its not helping either.

Vatsala
A: 

I use restlet 2.0m6 and here is the code snippet that I use -

@Post

public Representation process(Representation entity)

{

try

{

DomRepresentation dom = new DomRepresentation(entity);

Document d = dom.getDocument();

.

.

} catch(Exception e)

{ e.printStackTrace(); }

and it throws a Null Pointer exception at the dom.getDocument() line. Which means no data actually arrived.

And my flex bit looks like this - var service : HTTPService = new HTTPService(); service.method="POST"; service.contentType="application/xml" service.url=url; var token :AsyncToken = service.send(params);

where params is an XML object.

Vatsala