I created a custom module to invoke hook_default_wsclient_service() to connect with the PBS TV Schedules API via REST. Most of the time it works great, but on every third or fourth load I get the following error.
WSClientException: Error invoking the REST service PBS TV Schedules API, operation upcoming_episodes: Failed to unserialize response in WSClientRESTEndpoint->call() (line 88 of /var/www/html/d7/sites/all/modules/wsclient/wsclient_rest/wsclient_rest.module).
Any idea what might be causing this, and more importantly, how to stop it from happening?
Comments
Comment #1
rellimevad commentedDid you ever find a fix for this? I'm getting the same error message, though mine is constant - it never works. Same deal - invoked via hook_default_wsclient_service. I have another service definition on the same site that works perfectly.
I've used Wireshark to sniff the traffic and the call is correct and the response valid.
Tried the on both 1.0-beta1 and 1.x dev with no joy.
Anyone have any ideas?
Comment #2
jesss commentedNo -- I ended up writing my own module to make my API calls.
Comment #3
PatchRanger commentedYou are not the only one who gets this error: it happens every time when you send request to non-JSON service.
The problem is that wsclient implicitly assumes that the service is JSON - and you can't change this behavior other than defining the formatter in the service settings programmatically.
In other words there is no UI for changing formatter. There wasn't: the patch from #1280332: Advanced REST service formatters + UI setting completely eliminates the issue.
Closed as a duplicate of forementioned issue.