I am using a PHP script to access the WEB API of gracenote. Though it works sometimes, it gives me a time out error most of the times. Here is the error I am getting:
exception: code=2001, message=Request to a Gracenote WebAPI timed
out., ext= PHP Fatal error: Uncaught exception
'Gracenote\WebAPI\GNException' with message 'Request to a Gracenote
WebAPI timed out.' in
/home/kubuntu/Downloads/php-gracenote-master/php-gracenote-master/php-gracenote/HTTP.class.php:1
Here is my very simple code:
<?php
include("./php-gracenote/Gracenote.class.php");
$clientID = "";
$clientTag = "";
$api = new Gracenote\WebAPI\GracenoteWebAPI($clientID, $clientTag);
$userID = "xxxxxxxxxxxxxxxxxx";
echo "UserID = ".$userID."\n";
$results = $api->searchArtist("Bob Dylan");
var_dump($results);
What am doing wrong?
I had the same issue where every 9 out of 10 requests the connection would time out with the following error:
http: external request POST url=https://1234567.web.cddbp.net/webapi/xml/1.0/, timeout=20000 exception: code=2001, message=Request to a Gracenote WebAPI timed out., ext=0
Fatal error: Uncaught exception 'Gracenote\WebAPI\GNException' with message 'Request to a
Gracenote WebAPI timed out.' in /usr/samba/dev/gracenote/php-gracenote/php-
gracenote/HTTP.class.php:110 Stack trace: #0 /usr/samba/dev/gracenote/php-gracenote/php-
gracenote/HTTP.class.php(94): Gracenote\WebAPI\HTTP->validateResponse(false) #1
/usr/samba/dev/gracenote/php-gracenote/php-gracenote/HTTP.class.php(144): Gracenote\WebAPI\HTTP-
>execute() #2 /usr/samba/dev/gracenote/php-gracenote/php-gracenote/Gracenote.class.php(59):
Gracenote\WebAPI\HTTP->post('<QUERIES>? ...') #3 /usr/samba/dev/gracenote/php-
gracenote/example.php(31): Gracenote\WebAPI\GracenoteWebAPI->register() #4 {main} thrown in
/usr/samba/dev/gracenote/php-gracenote/php-gracenote/HTTP.class.php on line 110
The reason ( i suspect) is the missing SSL option parameter for the curl connection.
I was able to fix permanently by adding this to line 38 in HTTP.class.php.
curl_setopt($this->_ch, CURLOPT_SSLVERSION, 3);
As suggested by Yavor, the problem had to do with SSL settings on the server. But we have now added full support for TLS v1.2, so your original code should work with the default SSL settings.
You should not use SSL v3 because of the POODLE vulnerability.
You should use try/catch to surround gracenote api calls, gracenote HTTP client throws various of exceptions
e.g.
https://github.com/richadams/php-gracenote/blob/25e0346443dd5026a4bc9f0d62a589d44bdc133b/php-gracenote/HTTP.class.php#L110
Related
Flutter/Dart
Why does http.get('http://18.191.190.195/') throw above error while using chrome browser http://18.191.190.195/ shows the Test Page and says:
If you can read this page, it means that the Apache HTTP server installed at this site is working properly.
Cause: Poor network connection.
Suggestion: Error reporting should be more descriptive from Dart.
I am using Oracle10g plsql to access a Jasperserver webservice in order to generate a PDF and store it in a blob. I follow this post
When I change the Jasperserver host I replace the url from
http://myOLDserver:8080/jasperserver/rest_v2/reports/apex/reportname.pdf?j_username=jus&j_password=jpw&ID=2758
to
http://myNEWserver:8080/jasperserver/rest_v2/reports/apex/reportname.pdf?j_username=jus&j_password=jpw&ID=2758
and the procedure raise an error like this
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1389
ORA-29261: bad argument
ORA-06512: at line 51
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1029
ORA-12541: TNS:no listener
on executing UTL_HTTP.begin_request
The machine of my oracle user ping myNEWserver correctly and the url in a browser is working correctly
I found the problem was an incorrect configuration of the DNS of my db server.
From different db server correctly configured the UTL_HTTP.begin_request with the same URL work without error with no db configuration like ACL or WALLET.
The db server that call the procedure is AIX Version 6.1 and I have to modify the /etc/resolv.conf and the hosts (because it is not possible to reboot the servere immediatly).
I hope this solution can help
I am getting below exception while connecting to pipeline debugger. I tried to re start application server / HTTP service / system as well but no luck. Any one have faced the same problem .
com.intershop.beehive.core.rapi.soap.ConnectException:
http://localhost:80/INTERSHOP/servlet/WFS/SOAP/-/SessionMgmtService;
nested exception is:
com.intershop.beehive.core.rapi.soap.SOAPException: SOAP-Stub:
response payload is not wellformed at
com.intershop.beehive.core.rapi.soap.SOAPStub.getPayload(SOAPStub.java:381)
at
com.intershop.beehive.core.internal.bos.session.SessionMgmtService_SOAPStub.setTimeout(SessionMgmtService_SOAPStub.java:130)
at
com.intershop.studio.server.suite6.remote.emc.Session.(Session.java:111)
at
com.intershop.studio.server.suite6.remote.RemoteSuite6ServerInstance.doConnect(RemoteSuite6ServerInstance.java:113)
at
com.intershop.studio.server.remote.services.impl.AbstractRemoteServerInstance$1.run(AbstractRemoteServerInstance.java:52)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56) Caused
by: com.intershop.beehive.core.rapi.soap.SOAPException: SOAP-Stub:
response payload is not wellformed at
com.intershop.beehive.core.rapi.soap.SOAPStub.getPayload(SOAPStub.java:368)
... 5 more
Haven't encountered this until today when I was redeploying my meteor app using mupx I got this error:
events.js:141
throw er; // Unhandled 'error' event
^
Error: Timed out while waiting for handshake
at null._onTimeout (/usr/local/lib/node_modules/mupx/node_modules/ssh2/lib/client.js:138:17)
Help? Thanks!
Check you IP address in mup.json, and use your internal IP address (like 192.168.xxx.xxx) instead public IP.
I have a spring-boot application which is monitored by monit.
Monit just check the /health endpoint spring is exposing.
Basically, monit registered the following checks :
check host hopsearch_connection with address 127.0.0.1
if failed url http://127.0.0.1:8089/health with timeout 15 seconds then alert
check host hopsearch_health with address 127.0.0.1
if failed url http://127.0.0.1:8089/health
and content != 'DOWN'
with timeout 60 seconds
then alert
and the web application return something like that :
{"status":"UP","jestHealth":{"status":"UP","lastQuerySuccess":true},"diskSpace":{"status":"UP","free":14439550976,"threshold":10485760},"rabbit":{"status":"UP","version":"3.3.2"},"redis":{"status":"UP","version":"3.0.0"},"mongo":{"status":"UP","version":"2.6.1"}}
In this spring application, I have a general #ExceptionHandler to log all unexpected errors and to display an error page :
#ExceptionHandler(Exception.class)
#ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public String handleDefaultError(Exception ex, HttpServletRequest httpRequest) {
logException(httpRequest, ex);
return "error";
}
And this #ExceptionHandler logs every call from monit :
<11>May 1 13:20:39 IP 13:20:39.339 t=http-nio-8089-exec-3 l=ERROR c=c.h.s.w.c.ErrorManager m=Error 500
----------------------------------------------------------------
Request Path=http://127.0.0.1:8089/health
Method=GET
----------------------------------------------------------------
Header :
----------------------------------------------------------------
host = 127.0.0.1:8089
accept = */*
connection = close
user-agent = monit/5.4
----------------------------------------------------------------
<11>May 1 13:20:39 IP 13:20:39.340 t=http-nio-8089- exec-3 l=ERROR c=c.h.s.w.c.ErrorManager m=Unexpected error : java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[na:1.8.0_25]
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) ~[na:1.8.0_25]
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) ~[na:1.8.0_25]
at sun.nio.ch.IOUtil.write(IOUtil.java:65) ~[na:1.8.0_25]
From monit perspective, everything is fine and the check works.
From my perspective, the application works. But I have a lot of errors dumped in the log.
I don't succeed to reproduce on my workstation with curl. This exception only happens on the server with monit.
Is it possible to ignore an error based on a specific user agent in an ExceptionHandler ? (and how ?)
It wouldn't be the best solution but I don't see any other way.
Any thoughts about that ?