I have been trying to connect to a web service which I previously had set up using a soap request in PHP, like so:
$client = new SoapClient($this->config->item('WSDL'));
$response = $client->Login(array('email' => $this->input->post('email'), 'password' => $this->input->post('password')));
this worked when the WSDL url ended in asmx?WSDL but now its a different url ending in .xml and it doesn't work...I keep getting the following error: "PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in..."
Can anyone help me please? It is hurting my head, thanks!
URL of WSDL can be ended with anything. Try to echo your WSDL URL and load it by browser.
$client = new SoapClient(exit($this->config->item('WSDL')));
Related
I'm using GuzzHttp in my laravel project to post some data to an API. In my local enviroment I have to to create my client with the cacert.pem file verification like this:
$client = new \GuzzleHttp\Client(['verify' => 'C:\wamp64\bin\php\php7.2.14\cacert.pem']);
But I can't do so on my shared hosting. So, removing that verification:
$client = new \GuzzleHttp\Client();
Results on an internal server error:
[2019-06-11 15:17:10] local.ERROR: GuzzleHttp\Exception\ServerException: Server error: `POST https://pruebas2.mayoristaseguridad.es/tiendaseguridad/02-ConectorLaravelPrestashop/ConectorCategorias.php` resulted in a `500 Internal Server Error` response in /home/admin/web/iberoseguridad.eu/public_html/csv_products/vendor/guzzle/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Is there a way to fix this error?
Not sure if this will help, here it goes anyways
// Disable validation entirely (don't do this!).
$client->request('GET', '/', ['verify' => false]);
Guzzle verify api
This ended up being a remote server error, not mine. I just had to communicate that error with the server's maintainer and now it works just fine.
I am using https://github.com/jamesiarmes/php-ews library to connect to our Microsft Exchange Server 2010 SP3 but I am getting this error: Fatal error: Uncaught SoapFault exception: [HTTP] Unauthorized in
I am using the example provided under: /examples/message/create.php
and the error is triggered on this line:
index.php
$response = $client->CreateItem($request);
Client.php
$response = $this->soap->{$operation}($request);
When I try to access the wsdl file from the browser it works fine and after authentication, I can see all the options under Services.wsdl .
What do you think the problem is?
Is there some settings that I need to enable on Microsoft Exchange in order to use the SOAP services?
I have a problem co communicate with SOAP service in php:
My code for client:
$url = "https://XXXX.com/DataService.svc?singleWsdl";
$client = new SoapClient($url);
var_dump($client->__getFunctions()); // ExportScheduleData(ExportScheduleData $parameters)
$aclient->ExportScheduleData(array());
I got:
Uncaught SoapFault exception: [HTTP] Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.
change soap version to 1.2:
$client = new SoapClient($url, array('soap_version' => SOAP_1_2));
And request could not be completed: when I refresh page it still in loaging state - any errors or so.
===== update =====
Looks like service use WS-Security. They provide certificate file, but:
Warning: SoapClient::SoapClient(): Unable to set local cert chain file `C:\xampp\htdocs\workspace\sandbox.dev\public\sandbox.cer'; Check that your cafile/capath settings include details of your certificate and its issuer in C:\xampp\htdocs\workspace\sandbox.dev\public\sandbox.php on line 34
Resolved.
Write a Java application for ws-secutity check and and query java app from php script. I use java tcp server.
I have written a very simple SOAP Server to check access to the server but I'm getting an error.
The server is a brand new VM of Windows Server 2008R2 (which I installed today to check this) I then installed WAMP which is working correctly. I think the issue is more of a configuration one but I'm no expert from here so need some help finding it.
I have enabled SOAP in WAMP. The WSDL is fine, I have checked it on a hosted server and it works as expected along with the server and client php files.
The error received at the client:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from './Soaptest.wsdl' : failed to load external entity "./Soaptest.wsdl" in
C:\wamp\www\Connector\Testing\c20\c20simpleClient.php:7
Stack trace: #0 C:\wamp\www\Connector\Testing\c20\c20simpleClient.php(7):
SoapClient->SoapClient('./c20simpleSoap...') #1 {main} thrown in
C:\wamp\www\Connector\Testing\c20\c20simpleClient.php on line 7
The Soap Server:
function Test(){
return true;
}
$server = new SoapServer("Soaptest.wsdl");
$server->addFunction("Test");
$server->handle();
The client (Line 6+):
$url = "./Soaptest.wsdl";
$client = new SoapClient($url);
echo "client created<br>";
$result = $client->Test();
echo "<hr>Method Test: <pre>".(string)$result."</pre>";
Aside from enabling soap in the php config, is there anything I need to do in Apache or php to enable SOAP?
This question already has answers here:
SOAP-ERROR: Parsing WSDL: Couldn't load from <URL>
(13 answers)
Closed 3 years ago.
I have a php code that uses soap
I get the error
ERROR: WSDL - SOAP-ERROR: Parsing WSDL: Couldn't load from
It's a security wsdl so I need to send also username and password.
what is wrong in my code?
I see it at web and does'nt work from soap in php code.
here is my code:
<?php
ini_set("soap.wsdl_cache_enabled", "0");
$soap_url = 'http://some-ip/prod/app/soap/user/storeitemws?WSDL';
$sh_param = array(
'username' => 'aya',
'password' => 'aya');
$soap_client = new SoapClient($soap_url);
$test = $soap_client->Authenticate($sh_param);
echo $test . "\nDone";
?>
thanks
See in the documentation:
$client = new SoapClient("some.wsdl", array('login' => "some_name",
'password' => "some_password"));
change username to login and try the above method
Is Authenticate() a SOAP method? In what way is the wsdl secured? What happens if you visit it using the browser?
The SoapClient does not support authentication on the WSDL it's built from, so you'll have to download the WSDL manually (using cURL for example) and create the SoapClient from that file.
for using on localhost, install WAMP.
Click on wamp tray icon > PHP Services > and enable these options:
openssl,
php_openssl,
curl;
SOAP,
p.s. possibly, some of free hostings dont have these options
Maybe some firewall ? you cannot access to the server ?