Restlet consume post webservice, add json-string as representation

I want to consume a rest webservice using restlet. This will be done with a post. What do I need to add to the following code:

ClientResource resource = new ClientResource("url");      
resource.setChallengeResponse(ChallengeScheme.HTTP_BASIC, user, password);

I have a Json string and in the code where my rest-webservice is implemented the input is an Representation object. I need my parameter to be(being the jsonstring) in the enitity.gettext() method if possible.

public StartProcessInstanceResponse startProcessInstance(Representation entity)
jsonstring = entity.gettext();

Thanks in advance.

Answers


Found the answer myself... You should make a Represenation object like this

Representation rep = new StringRepresentation(jsonString);

Then you can post like this:

resource.post(rep);

That's it...


Need Your Help

How to get information about contents of Qt listbox in another process

c++ qt user-interface accessibility cross-process

I got an application written using Qt and I would like to read data in Qt listbox.

Error Converting C# to VB.NET

c# vb.net c#-to-vb.net code-conversion

I am trying to convert this method to VB.NET but the online converters seem to make a mess of converting it. Can someone help:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.