0

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

  • I know, I know, but I'd strongly recommend to use Magento's REST API, and REST over SOAP in general. – Rápli András Jul 25 '14 at 20:30
  • Its 3rd party extension that uses SOAP API, so i have to make it work for that. – Trimantra Software Solution Jul 26 '14 at 5:42
1

Issue is resolved. On close observation, i found additional space on first line of index.php . On removing that it start working properly.

0

I think you server can't resolve his own domain. you can verify that with wget "your host" on your server

add you domain to /etc/hosts

  • I tried to wget my domain from server and it was connected successfully and their is already an entry for server IP address mapped to server name on /etc/host file – Trimantra Software Solution Jul 25 '14 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.