Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP SoapServer ampersand is encoded

I'm working on a webservice using SoapServer in PHP. Previously, I made another webservice using exactly the same technique. My new project is on the same server, but in another subdirectory. In the url of the service and the soapserver is a version number included. This is the way my SoapServer is created in PHP:

$server = new SoapServer("https://".DOMAIN."/webservice/index.php?v=1.0.0&wsdl=1");
$server->setClass('SoapHandler');
$server->handle();

The whole PHP page is the same in my example Soap Service, only the url is different ofcourse. When I do a call to the webservice with soapUI, the following error is returned:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://myurl.com/webservice/index.php?v=1.0.0&wsdl=1' : failed to load external entity "https://myurl.com/webservice/index.php?v=1.0.0&wsdl=1"

As you can see, the ampersand is replaced with &. I tried to change the encoding to UTF-8, this doesn't work either.

Who can help me out?

like image 469
harmjanr Avatar asked Nov 23 '25 01:11

harmjanr


2 Answers

You have to enable your openssl module in your php.ini file. Otherwise you can't access a domain with SSL (https).

Otherwise you should check your domain from your local server and check the return of the WSDL file with curl or lynx.

like image 109
René Höhle Avatar answered Nov 24 '25 17:11

René Höhle


We had an .htaccess, only allowing my IP address while it should also allow the server's IP.. Deleting this solved the problem. Thanks for your help!

like image 25
harmjanr Avatar answered Nov 24 '25 17:11

harmjanr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!