2012-12-25 10 views
34

Sabun istemcisi kullanan bir kodda hata ayıklamaya ihtiyacım var. Ben php.net içinde GetLast * yöntemler buldum ama debug son isteğini elde etmeye çalışmak zaman kod yürütme BOŞSoapClient, hata ayıklama isteği nasıl bırakılır?

<?php 

    $client = new SoapClient("http://www.webservicex.net/ConverPower.asmx?WSDL"); 

    $response = $client->ChangePowerUnit(array(
     "PowerValue" => 100, 
     "fromPowerUnit" => "horsepower", 
     "toPowerUnit" => "megawatts" 
    )); 


    echo "====== REQUEST HEADERS =====" . PHP_EOL; 
    var_dump($client->__getLastRequestHeaders()); 
    echo "========= REQUEST ==========" . PHP_EOL; 
    var_dump($client->__getLastRequest()); 
    echo "========= RESPONSE =========" . PHP_EOL; 
    var_dump($response); 

?> 

sonucu verir:

$php soap_test.php 

====== REQUEST HEADERS ===== 
NULL 
========= REQUEST ========== 
NULL 
========= RESPONSE ========= 
object(stdClass)#2 (1) { 
    ["ChangePowerUnitResult"]=> 
    float(0.0746) 
} 

Nasıl vücudun içeriği almak için ve son SoapClient talebinin başlıkları? SoapClient nesne DOĞRU ayarlı iz seçeneği ile oluşturulmuşsa

cevap

43

These functions çalışır.

Dene:

@xdazz ederim aramayı görüntüleyebilir böylece de `` ` "istisnalar" SoapClient yönteminde parametrelere => 0``` eklemek tavsiye doğru olsa
$client = new SoapClient("http://www.webservicex.net/ConverPower.asmx?WSDL", array('trace' => 1)); 
+2

Hatalı bir yanıt alsanız bile – Dragon54