I have a website which frequently makes SOAP calls to a particular API. The site was working fine for a few months of time, however the SOAP functionality suddenly stopped working without any known reason, the error was "Cannot connect to host".
The WSDL service has not moved or shut down.
After this I updated plesk from version 12 to version 17. SOAP client is still not working but now its a different error:
SOAP-ERROR: Parsing WSDL: Couldn't load from (URL) : failed to load external entity (URL)
This is my SOAP call:
$opts = array('http'=>array('user_agent' => 'PHPSoapClient'));
$context = stream_context_create($opts);
libxml_disable_entity_loader(false);
$client = new SoapClient($url,array('stream_context' => $context,'cache_wsdl' => WSDL_CACHE_NONE));
Any possible solutions?
EDIT:
New information came in, so the API server had DNS problems, how can I restore my connection to the API?
Your php server is clearly not reaching out the soap server. This might help:
Try checking directly from php server if the service are reachable:
wget {url} > page.txt
nano (or equivalent) page.txt
Try using other program to consume the server, I suggest Soap Ui
On the php server try ping the service url and see if the IP is resolved.
Check if any other soap service is reachable, you can use this service
If this not help you coming up with a solution, post here the results to help others solving it.
Related
I am trying to download an external file using guzzle. This is the code that I use:
$url = 'https://testurl.net/dl/test.mp4?mime=true';
$path = storage_path('app/remote-uploads/test.mp4');
$client = new Client();
$client->get($url, ['sink' => $path]);
The code works and downloads from localhost just fine but when I push it to production I receive this error:
Client error: `GET https://testurl.net/dl/test.mp4?mime=true` resulted in a `403 Forbidden` response:
{"status":403,"msg":"download ISP is different to request ISP. request: AS20115 download: AS30083"}
I am not quite sure how to go about this and would really appreciate any help!
Seems that you are using https://openload.co/api#download-getlink to get a download link and download it then.
In this this I can assume that you hosting provider uses different IP for each outgoing HTTP request, and these IPs are even from different ASs (you think about them as "namespaces", check AS20115 and AS30083). And this particular site (openload.co) treats the situation like a security problem and prevents downloading (the second request).
There is nothing you can do on the application level. You have to talk to you ISP about it's routing rules. Maybe ask about (buy) a static IP address.
You can try to play around HTTP 1.1 keep-alive connections to send all requests through the same connection, but it depends on a server, and openload.co might not support this feature.
P.S. Please, include more details in questions in the future. Others are not wizards to read context from your mind :)
if you using vpn. please disable it
I've got this problem:
I'm using a Web Service with PHP soap. Everything works fine on my localhost, but when I put it on the remote server I get this error:
SoapClient::SoapClient(): SSL operation failed with code 1.
OpenSSL Error messages: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
Remote server is running on HTTPS. Remote server uses PHP 5.3 and on localhost PHP 5.5. Does anybody know why it works on localhost and not on the remote server? And if so, how can I fix this problem? I already read more than 10 questions but none of them worked and 60% of them were for JAVA and not for PHP. I will greatly appreciate any kind of help, because I'm trying to get this fixed more than 3 whole days. This is how I call Web Service:
$wsdl_url = 'https://somehost.com/someWebservice.wsdl';
$client = new SoapClient($wsdl_url, array('login' => $username, 'password' => $password, 'trace' => true));
EDIT: I'm using another 3 Web Services on my remote server and they work fine. That's one more reason why I don't have any clue why this one doesn't work.
So ive already fixed the problem with handshake failure. It was due to php version. As soon as i upgraded to php 5.5 it solved the problem.
I have a simple php file which makes SOAP requests. This is running on my local computer with XAMPP as a webserver.
I am trying to catch the request made in fiddler, I can see the request to my php file but that just returns the html for the page. I want to catch the request made when I create the SOAP client to see what is being sent off.
Is there some setting in fiddler I need to change to be able to see the response? Or some sort of proxy I can send my request through so it is visible in fiddler?
You can pass the proxy settings to the SoapClient class like this:
$client = new SoapClient("request.wsdl", array('proxy_host' => "localhost",
'proxy_port' => 8888));
This assumes that fiddler is running on it's default port (8888).
i've been trying to set up a secure communication using client side certificate between my client application and my server application.
I've set up a the configuration in my apache web server and both in my browser just to make sure that it works and it does.
i'm using zend framework 1.12, and according to the documentation on Zend website
the following example should work:
$config = array( 'sslcert' => 'path/to/ca.crt', 'sslpassphrase' => 'p4ssw0rd');
$adapter = new Zend_Http_Adapter_Socket();
$adapter->setConfig($config);
$http_client = new Zend_Http_Client();
$http_client->setAdapter($adapter);
$http_client->setUri('https://somewhere.overtherainbow.com:1337/bluebird');
$http_client->request();
but everytime i just get the same exception
Unable to Connect to ssl://somewhere.overtherainbow.com:1337
There is no doubt that i'm using the right certificate and passphrase and there is access to the remote machine
so where could be the downfall ?
Sounds like a simple firewall issue - login to the server and stop iptables and then see if it connects. Or add an exception to the clients IP to access mysql. Also check :1337 is open
I've been trying to figure out what's wrong and what is the problem with this following PHP code, which is trying to make a SOAP call. I can't get it to work when I host the PHP on free web hosting sites
include_once("nusoap/lib/nusoap.php");
// create the client and define the URL endpoint
$client = new nusoap_client('http://xxxyyy.zzz:1881/');
// set the character encoding, utf-8 is the standard.
$client->soap_defencoding = 'UTF-8';
$client->call('sendSMS', array( 'uName' => 'kd81fg',
'uPin' => '18416',
'MSISDN' => '09156300965',
'messageString' => 'THIS IS A SAMPLE MESSAGE',
'Display' => '1',
'udh' => '',
'mwi' => '',
'coding' => '0' ),
"http://ESCPlatform/xsd");
When I tried using this hosted on my localhost, it work, but when I try to upload it (I tried so many free web hosting sites) to a web hosting site, and try to run it, it will not work.
I don't know what's wrong but I'm pretty sure that the code is perfect. I'm guessing that the free web hosting sites that I tried do not allow SOAP / XML , or maybe cURL is disabled, or url_fopen is Off on their php.ini (config) or something . I don't really know what's wrong right now and I need to finish what I'm doing right away.
UPDATE: I tried to echo what's the error and here what it says
HTTP Error: Couldn't open socket
connection to server http://xxxyyy.zzz:1881/, Error (111) Connection refused.
I checked the phpinfo for curl and stuff.
I was thinking of that too that maybe the problem is on the free hosts that they dont allow connection on port 1881, but I tried to scan and check if 1881 is open on my localhost, and it says my 1881 is closed, and now I'm confused.
Probadly port 1881 is closed on the free hosts. Try to close it on your pc/router. If the same error appears than this should be the problem.
EDIT: Did you check the phpinfo() for curl and stuff?
EDIT 2: Don't you have to add the client's host to your profile at the service provider's site like when you want to use the Google maps API?
Very often free web hosts will block outgoing ports. If you can set up a reverse proxy with apache or nginx (I'm assuming you're hosting the SOAP server).