Recently i have moved my application to dedicated server from VPS. On VPS Soap API is working good on VPS, but after moving to dedicated server its not working.
I have enabled PHP Open SSL, xmlrpc, php-soap extension, but still not working.
i have prepared a test file to test SOAP API
<?php
ini_set('display_errors', 1);
ini_set("default_socket_timeout", 6000);
echo $host = "www.host.com/index.php"; //our online shop url
$client = new SoapClient("http://".$host."/api/soap/?wsdl"); //soap handle
$apiuser= "user"; //webservice user login
$apikey = "key"; //webservice user pass
$action = "sales_order.list"; //an action to call later (loading Sales Order List)
try {
echo $sess_id= $client->login($apiuser, $apikey); //we do login
die;
print_r($client->call($sess_id, $action));
}
catch (Exception $e) { //while an error has occured
echo "==> Error: ".$e->getMessage(); //we print this
exit();
}
?>
It give me below error message
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.sanasana.com/index.php/api/soap/?wsdl' : XML declaration allowed only at the start of the document in /var/www/html/sanasoap.php:5 Stack trace: #0 /var/www/html/sanasoap.php(5): SoapClient->SoapClient('http://www.sana...') #1 {main} thrown in /var/www/html/sanasoap.php on line 5
I have also give full permission to /tmp folder.
Note: New dedicated server is a cloud server with Load balancer in front.
Can you one please help me out.
Thank you