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.
Related
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.
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 hope someone can help me because I am looking for the solution since 2 working days...
I have a php website which need to request a distant webservice.
When I try it on my computer (Win7 + WAMP), it works well.
When I try it on the webserver (CentOs6), it return me the following error :
SOAP-ERROR: Parsing WSDL: Couldn't load from
'http://ip_address:8080/gss-0.1/FileUtilities?wsdl' : failed to load
external entity "http://ip_address:8080/gss-0.1/FileUtilities?wsdl"
NB: the webservice is on the same network of my webserver (I do not use the same IP/port).
I know that the WSDL is accessible from the webserver because it is accessible using curl linux function.
curl http://ip_address:8080
My php code is:
<?php
$wsdl = "http://ip_address:8080/gss-0.1/FileUtilities?wsdl";
try{
$client = new SoapClient($wsdl ,array('trace' => 1,
'exceptions'=> 1,
'cache_wsdl' => WSDL_CACHE_NONE
));
}
catch(Exception $e) {
echo $e->getMessage();
}?>
OK I found a solution but I don't understand the problem...
So I execute this Linux command
setsebool -P httpd_can_network_connect on
And now all is running !
Response here: Thanks to user2533111
If its not firewalled there at your web server and its working in your local but not at your webserver(CentOS). its might be a case of different PHP version and php.ini settings.
Can you compare your PHP version and those below extensions in your CentOs server with your WAMP at local.
S0AP,
php_openssI,
openssI,
curI;
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
I have some code that connects to a newsletter service via SOAP. It works with no problem on our dev server, but on our live server it doesn't work at all. It's not returning any errors; just a blank white page. I've put some error_logs into the code and found exactly where it stops working - on the line creating the new SoapClient. Is there some kind of server config that needs to be set? Our code is identical between dev and prod, so the only thing I can figure is a server issue. (Note that the first chunk of code below was provided by the newsletter service, not written by me.)
# bronto API session/connection setup
ini_set("soap.wsdl_cache_enabled", "0");
date_default_timezone_set('America/Chicago');
$wsdl = "https://api.bronto.com/v4?wsdl";
$url = "https://api.bronto.com/v4";
/*error log statements up to this point return what is expected;
an error log after the following line (starting with $client = new SoapClient)
does not get triggered at all. */
$client = new SoapClient($wsdl, array('trace' => 1, 'encoding' => 'UTF-8'));
$client->__setLocation($url);
$token = "XXX";
$sessionId = $client->login(array("apiToken" => $token))->return;
$client->__setSoapHeaders(array(new SoapHeader("http://api.bronto.com/v4",
'sessionHeader',
array('sessionId' => $sessionId))));
I've also tried something like this to explicitly see any errors, but no luck - still nothing in the error log.
try {
$client = #new SoapClient($wsdl, array('trace' => 1, 'encoding' => 'UTF-8'));
}
catch (SoapFault $E) {
error_log($E->faultstring) ;
}
error_log("ok");
I would check the installed PHP packages on the dev server and compare to the Prod server. fr2.php.net/manual/en/soap.setup.php
This will more than likly be a config setup for php on the live server, but here are the common problems i have had with SOAP on php,
First thing is check the allowed memory for php on live comparable with dev (SOAP is big and bad for memory)
Is the php on the live server the same version as the dev server,
Is the live server authorized to access the SOAP server (if auth is used on an IP Level)
as one of the SOAP packages i have used did this to me i found out there was a version mismatch, last but not least could you tell us what SOAP Library if any other then php default your using so we can help as your code looks good :)
thinking about it have you install soap i don't think php natively supports it i think its a pear or pecl package and if your using XAMPP or easyPHP on dev these have all of both all ready included in php.