1

I'm building load tests for a web API, and I can't get one of them to work.

The url is something like http://myserver/myapp/mymethod and it calls a java method like public void mymethod(mytype param)

And I don't know how to pass that param...

I'm getting this error:

The server refused this request because the request entity is in a format not supported by the requested resource for the requested method (Cannot consume content type).

EDIT:

I've tried setting Content-Type = "application/json" and passing a json parameter but now the server says: An error occured while trying to do a POST request.: java.net.SocketException: Unexpected end of file from server

The parameter, which is correct and I can get the values when debugging the webservice is:

{
"email": "name@server.com", 
"login": "name", 
"password": "1234"
}
diminuta
  • 1,545
  • 8
  • 32
  • 55

1 Answers1

0

Well, the solution was just to pass a json parameter.

My class had the following properties:

private String email;
private String login;
private String password;

So I only needed to build a json object like:

{
"email": "name@server.com", 
"login": "name", 
"password": "1234"
}

and pass it as a parameter to the HTTP Request, with an empty name.

diminuta
  • 1,545
  • 8
  • 32
  • 55