I am trying to do a very simple integration with the Salesforce PHP Toolkit 20.0. Everything works fine on my local server so I think it must be a server setting, but I don't see any issues with my server configuration. Additionally, the errors I'm getting aren't helping at all.
I've removed the actual authentication piece because I'm getting errors just running the basic createConnection function. Here is the code:
define("SOAP_CLIENT_BASEDIR", "soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
try {
$mySforceConnection = new SforceEnterpriseClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
}
catch (Exception $e) {
exit($e->faultstring);
}
Running that code alone, I get the following error:
<br />
<b>Fatal error</b>: SoapClient::__setSoapHeaders(): Invalid SOAP header in <b>/home/website/public_html/app/equity/soapclient/SforceBaseClient.php</b> on line <b>325</b><br />
My server is running PHP 5.6 and OpenSSL, SOAP, SSL, and cURL is enabled.
I have no idea why, but changing my Salesforce password fixed the issue.
Related
Getting
Apache HTTP SERVER has stopped working while using soap client in.
if SOAP API url not exist getting attached screen shot error again
Getting this error
I am using xampp v3.2.2 with php7.
Code which I am using
try
{
$vies = new SoapClient('http://www.webservicex.com/spc/globalweather.asmx?wsdl', array('exceptions'=>true));
var_dump($vies);
}
catch(SoapFault $e){
$return_value = 'VAT check service is not available.';
return $return_value;
}
Note:- same code working fine with 5.6.
Thanks in advance
I have installed AMPPS on OS X Mavericks and I am getting the error below when I try to access a WSDL over HTTPS in PHP by using the SoapClient class.
SOAP-ERROR: Parsing WSDL: Couldn't load from
'https://www.some-domain.com/Webservice.asmx?WSDL' : failed to load
external entity
"https://www.some-domain.com/secure/api/Webservice.asmx?WSDL"
OpenSSL, SOAP and cURL is enabled in when I run phpinfo(). I can retrieve the WSDL contents just fine by using file_get_contents(). There is no firewall blocking the connection. Other computers on the same network can connect just fine. Below is my code. It works on the production server as well as several other computers that I have used it on.
$this->wsdlUrl = 'https://www.some-domain.com/Webservice.asmx?WSDL';
$this->client = new SoapClient($this->wsdlUrl);
$this->client->Connect(array(
/* Login credentials */
));
I have also tried to use a stream context with verify_peer set to false, but with the same result. Increasing the default_socket_timeout option also does not work as some people have suggested.
I understand that there are several other questions concerning this error, but none of the proposed solutions that I could find work for me.
Any ideas? Thanks in advance!
I'm sure this will point you to the right direction:
try {
$sc= new SoapClient('https://www.some-domain.com/Webservice.asmx?WSDL');
$sc->Connect(/* Login credentials */);
} catch (SoapFault $fault) {
print_r($fault->faultstring);
}
I've created this simple example based on wsdl mode sample of wso2 framework for php.
<?php
try {
$client = new WSClient(array("wsdl"=>"http://footballpool.dataaccess.eu/data/info.wso?wsdl",
));
$proxy = $client->getProxy();
$result = $proxy->TopGoalScorers(array('iTopN'=>1));
echo "TEST!!!<br />";
echo '<pre>';
print_r($result);
echo '</pre>';
} catch (Exception $e) {
echo "Message = ".$e->getMessage();
}
?>
If I execute this script in a web browser i got a http 324 error ERR_EMPTY_RESPONSE
And when i execute it in a shell it seems to work but at the end i get a segmentation fault error.
The same error will be reproduced using the sample file wsdl_11_client.php
If this line
$result = $proxy->TopGoalScorers(array('iTopN'=>1));
is commented no segmentation fault error will appear.
I'm using wsf wso2 framework for php version 2.1.0
libxml version 2.7.8
libxslt version 1.1.26
PHP Version 5.3.6-13ubuntu3.6
Ubuntu 11.10.
In my php.ini i've added
include_path = ".:/usr/share/php:/usr/lib/php5/20090626/wsf_c/scripts"
[wsf]
wsf.home="/usr/lib/php5/20090626/wsf_c"
;log_level2 shows warnings and errors
;wsf.log_level=2
;wsf.log_path="/var/log/wsf"
and i've added this extension in /etc/php5/conf.d/wsf.ini
; configuration for php WSF module
extension=wsf.so
Is my server misconfigurated? Or there are some errors in my php script?
Thanks in advance.
Francesco.
Same for me.
Taking into account the absence of activity on "WSO2 WSF for PHP" project, I suppose it would be better not to use it on production.
The best workaround probably would be to write Java proxy service which communicates with original service and returns something like JSON to PHP.
This question relates to the requirement to utilize a WCF service hosted in a Windows application on Windows 2008 Server, from PHP scripts which are hosted in IIS 7 on the same server, and from other applications hosted elsewhere.
The application has been developed and tested thoroughly on a Windows 7 machine using Visual Studio 2010, .NET Framework 4, IIS 7, and various versions of PHP.
On the Windows 7 machine, netsh was used as follows.
netsh http add urlacl url=http://localhost:8000/WCFService/ user=machinename\user
Various other ports were also successfully added and used during testing.
When the application was copied to the Windows 2008 Server, the essential parts of the application were successfully tested.
The same netsh command was used on Windows 2008 Server, yet localhost was replaced with the server IP and machinename with domain as follows:
netsh http add urlacl url=http://serveripaddress:8000/WCFService/ user=domain\user
During attempts to get the PHP SoapClient working, various user="..." options were attempted, including "everyone".
The initial PHP SoapClient script is as follows:
try {
$client = new SoapClient("http://serveripaddress:8000/WCFService/?wsdl");
} catch (Exception $e) {
echo $e->getMessage(), "\n";
exit();
}
During initial testing, the following errors were encountered:
Warning:
SoapClient::SoapClient(http://serveripaddress:8000/WCFService/?wsdl)
[soapclient.soapclient]: failed to open stream: HTTP request failed!
in C:\inetpub\wwwroot\Sites\www.myurl.com\WCF-Test.php on line 7
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O
warning : failed to load external entity
"http://serveripaddress:8000/WCFService/?wsdl" in
C:\inetpub\wwwroot\Sites\www.myurl.com\WCF-Test.php on line 7
SOAP-ERROR: Parsing WSDL: Couldn't load from
'http://serveripaddress:8000/WCFService/?wsdl' : failed to load
external entity "http://serveripaddress:8000/WCFService/?wsdl"
After some fiddling around the error reduced to the following:
SOAP-ERROR: Parsing WSDL: Couldn't load from
'http://serveripaddress:8000/WCFService/?wsdl' : failed to load
external entity "http://serveripaddress:8000/WCFService/?wsdl"
I then extracted the wsdl into a file and used the following PHP script:
try {
$client = new SoapClient("wsdl\wcf-wsdl.wsdl");
} catch (Exception $e) {
echo $e->getMessage(), "\n";
exit();
}
The error then changed slightly to the following:
SOAP-ERROR: Parsing Schema: can't import schema from
'http://serveripaddress:8000/WCFService/?xsd=xsd0'
I am of the opinion that the issue at hand relates to the "visibility" of the service, to the client, and possibly permissions.
After reading dozens of posts, I still have not been able to find a solution to this issue.
Any assistance will be greatly appreciated.
Many thanks in advance.
If the WCF Service is something you are hosting for it to be accessed by php clients you need to have a flat wsdl. On how to generate Flat Wsdl follow the below link:
How to flatten your wsdl
The same feature would be avaiable in the framework as part of .NET 4.5. Hope that helps you out.
If you know you are working with a .NET WCF service you can just change the location you download the wsdl from .svc?wsdl to .svc?singleWsdl and the WCF server will take care of the recursion / linking work for you.
This may the answer,.net has the default config make this error.
https://bugs.php.net/bug.php?id=47761
For the same WSDL, which is totally valid, I am able to access it properly using PEAR SOAP like this:
$WSDL = new SOAP_WSDL($this->wsdlUrl);
$proxy = $WSDL->getProxy();
But not able to make it work through Zend_Soap, when used like this:
$soapclient = new Zend_Soap_Client($this->wsdlUrl);
I get the following error when accessed through Zend_Soap_Client:
Error: SOAP-ERROR: Parsing WSDL: Couldn't load
from 'https://abc.xyz.com/agent/TestService.php?wsdl' : Start tag expected, '<' not found
Openssl is also enabled in my php.ini
Does anybody know why it doesn't work? and how I can fix it to use Zend_Soap properly?
You should check if the ssl-Certificate is valid. This Error Message is also thrown if ssl-certificate verification fails.
Check to make sure that no Ports are blocked in your hosting situation.
I've had the same error, though with different code just plain php, and was struggling with it for several days.
It turned out that my webhotel had blocked the port I needed to access the web service.
Or it could some proxy-related issue giving the same blocked result.
Are you using HTTP Authentication? Auth works with SOAP Client, however you cannot access password protected WSDL files
See https://bugs.php.net/bug.php?id=27777