Wednesday, 31 October 2018

PHP SoapClient doesn't work for my WebService. Basic Authentication problem?

I have to call a soap WebService that needs Basic Authentication. I tryed SoapUI with Basic Authentication and its working. WSDL page can be load from Browser correctly. There is no SSL releated problem.

I'm trying to do same call with SoapClient but not working. As I understand (with help of Burp Software) Authentication header isn't send with soapClient.

While I have this problem, I checked nearly all releated questions on StackOverflow and tryed everything that they suggest.

Here is my PHP code I'm working on it:

echo "<pre>";

$WSDL_URL='https://servis.turkiye.gov.tr/services/g2g/kdgm/test/uetds?wsdl';

$username='999999'; 
$password='999999testtest';

$params = array(
    'login' => $username,
    'password' => $password,
    'trace' => 0,
    'exceptions' => 0,
    'location' => $WSDL_URL,
    'uri' => $WSDL_URL
);

$soap = new SoapClient(null, $params);

$RESULT = $soap->servisTest( 'HELLO' );
echo "<h1>ServisTEST Result:</h1>";
print_r($RESULT);

Here is my error:

SoapFault Object
(
    [message:protected] => Client Error
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => /Applications/MAMP/htdocs/soap/test.php
    [line:protected] => 24
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => /Applications/MAMP/htdocs/soap/test.php
                    [line] => 24
                    [function] => __call
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => servisTest
                            [1] => Array
                                (
                                    [0] => HELLO
                                )
                        )
                )
        )
    [previous:Exception:private] => 
    [faultstring] => Client Error
    [faultcode] => s:Client
)



from PHP SoapClient doesn't work for my WebService. Basic Authentication problem?

No comments:

Post a Comment