jc.021286
jc.021286

Reputation: 220

API resulting in Parsing WSDL: Couldn't load from

I've been at this for the better part of 12 hours now. I keep getting connection issues. This is a non https request, though I have tried enabling the open_ssl.dll and other suggestions.

I can view the WSDL just fine in a browser http://www.soapclient.com/interop/interopTest.html also returns values for me.

my code:

<?php

function doWebService()
{
       ########################################################################
       # Do some SOAP / Call a Web Service
    $soap_url = 'http://WEBSITE/WebServices/PublicAPI.asmx?WSDL';
    //$soap_url = 'x.x.x.x/WebServices/PublicAPI.asmx?WSDL';

       $sh_param = array(
                'username' => 'admin_username',
                'password' => 'admin_password');

        $soap_client = new SoapClient($soap_url);

        $test = $soap_client->Authenticate($sh_param);

        echo $test . "\nDone";
    /*
    try
{
    $soap_url = 'http://WEBSITE/WebServices/PublicAPI.asmx?WSDL';
    //$soap_url = 'x.x.x.x/WebServices/PublicAPI.asmx?WSDL';

       $sh_param = array(
                'username' => 'admin_username',
                'password' => 'admin_password');

        $soap_client = new SoapClient($soap_url);

        $test = $soap_client->Authenticate($sh_param);

        echo $test . "\nDone";
    }
catch (Exception $e)
{
   echo "<pre>";
   print_r($e);
   echo "</pre>";
   exit;
}
*/
}

doWebService();
?>

It fails on the $soap_client = new SoapClient($soap_url) line. I've tried changing between PHP 4.0, 5.2, 5.3. 5.4 and 6.0. None help. I've tried enabling

extension=php_curl.dll
extension=php_openssl.dll
extension=php_soap.dll

This is on my website using the host: ntchosting.com

trying to access the API on another.

Actual error code

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://WEBSITE.com/WebServices/PublicAPI.asmx?WSDL' : failed to load external entity "http://WEBSITE.com/WebServices/PublicAPI.asmx?WSDL" in /home/www/MY_WEBSITE.com/main_php/_test_public_api.php:13 Stack trace: #0 /home/www/MY_WEBSITE.com/main_php/_test_public_api.php(13): SoapClient->SoapClient('http://WEBSITE...') #1 /home/www/MY_WEBSITE.com/main_php/_test_public_api.php(50): doWebService() #2 {main} thrown in /home/www/MY_WEBSITE.com/main_php/_test_public_api.php on line 13

All I want to do is be able to use the API to retrieve data and provide a sync between what I've got and another established software. Just does not seem to be remotely easy whenever I try and get my hands wet.

thanks, jc

Upvotes: 2

Views: 2342

Answers (1)

jc.021286
jc.021286

Reputation: 220

I managed to find out that the outbound connections were being blocked. Forced the IP to an allow list and things are working a bit better.

Upvotes: 3

Related Questions