Hugo Wetterberg introduced a nice option in HttpClient: http://drupalcode.org/project/http_client.git/commit/f0e56cb

He saved my day :) I'm interacting with a service which accepts URL encoded post data and returns a response in JSON format, so in wsclient_rest.module I changed line 44:
$this->client = new HttpClient(NULL, new HttpClientBaseFormatter(HttpClientBaseFormatter::FORMAT_FORM), FALSE, NULL, new HttpClientBaseFormatter(HttpClientBaseFormatter::FORMAT_JSON));

In my opinion it should be possible to introduce a feature in wsclient without breaking existing installations...

Comments

klausi’s picture

Currently we look into the settings array of the service if there is a formatter defined. So we could also do this for alternative response parsers.

We could even allow people to specify their own HttpClient class that does things as they want. Also, we have to take the exportability into account, as this is currently a bit broken (see #1087538: Support custom formatter to be exportable).

So first we need a concept how we store the formatter/parser settings and how people can introduce new formatters/parsers/HttpClients (info hook?). And it should all be exportable. And then it should be available in the UI, see also #1280332: Advanced REST service formatters + UI setting.

PatchRanger’s picture

Status: Active » Closed (duplicate)

Closed as a duplicate of #1280332: Advanced REST service formatters + UI setting: the patch from that issue does it - and much more.
Everybody is welcome for reviewing.