0

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.

KwintenP
  • 4,637
  • 2
  • 22
  • 30

1 Answers1

1

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...

KwintenP
  • 4,637
  • 2
  • 22
  • 30