Search code examples
phpweb-servicessoapwsdl

PHP/SOAP - How to create working request with SOAP


Here is my request in SoapUI:

enter image description here

With SoapUI i send the request and i receive good response.

Here is my PHP code so far:

<?PHP
    $wsdl = 'https://onlinefatura.xyz/foyws/FoyOnlineApiGateWS.asmx';


    try{
        $clinet=new SoapClient($wsdl);

        $ver =array(
            "UserName"=>"USERNAME",
            "Password"=>"PASSWORD",
            "ApiKey"=>"APIKEYHERE",
            "Date"=>"2017-11-09",
        );
        $quates=$clinet->GetAddedBalanceList($ver);

        var_dump($quates);


    }

    catch(SoapFault $e)
    {
        echo $e->getMessage();
    }

When i execute the code i receive:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://onlinefatura.xyz/foyws/FoyOnlineApiGateWS.asmx' : Premature end of data in tag html line 3

Somehow i'm doing something wrong. I'm not really sure if i made my PHP request correct.

Where is my mistake, and how the correct request should look like ?


Solution

  • With an SoapClient error like "Premature end of data in tag html" your link to the WSDL file is usually not correct.

    Try this one: https://onlinefatura.xyz/foyws/FoyOnlineApiGateWS.asmx?WSDL