SOAP hatası: bir nesnenin örneğine ayarlanmadı nesne

0 Cevap php

I found this question on here: http://stackoverflow.com/questions/927566/php-soap-issue-server-was-unable-to-process-request-object-reference-not-s

Ben sadece WSDL özel olduğunu, benzer bir sorunu var, bu yüzden ben denemek ve temel bir saat dilimi SOAP İstemci çalışma almak düşündüm.

Me özel WSDL ile kullanmak için diğer Söz konusu çözelti, mümkün değildir.

$response = $client->getTimeZoneTime(array('timezone'=>'ZULU'));

Gerçekten ne gerek çok boyutlu bir dizi PHP alarak ve bu, bu örneğin, gibi şeyler deli oluyor ve üretmeden, SOAP biçimli XML belgenin içine koyarak bir yoludur: -

<key>GetTimeZoneTime</key>
<item>ZULU</item>

İşte benim PHP bulunuyor:

try {

    $WSDL = 'http://www.nanonull.com/TimeService/TimeService.asmx?WSDL';
    $client = new SoapClient($WSDL, 
        array(
            "trace"      => 1,
            "exceptions" => 1,
            "soap_version" => SOAP_1_1
            ));

    $xml = '<GetTimeZoneTime><timezone>ZULU</timezone></GetTimeZoneTime>';

    $xmlvar = new SoapVar(
                $xml,
                XSD_ANYXML
    );

    $response = $client->getTimeZoneTime($xmlvar);

    echo "<pre>\n";
    echo "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
    echo "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
    echo "</pre>"; 

} catch (SoapFault $exception) {
    echo "<pre>\n";
    echo "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
    echo "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
    echo $exception;
    echo "</pre>";
}

Bu ürettiği isteği:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.Nanonull.com/TimeService/">
    <SOAP-ENV:Body>
        <GetTimeZoneTime>
            <timezone>ZULU</timezone>
        </GetTimeZoneTime>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Ve SOAP hatası olduğunu:

Server was unable to process request. ---> Object reference not set to an instance of an object.

Bir soap isteği için uygun biçime çok boyutlu bir PHP dizi dönüm doğru yolu nedir?

SOAP hata aslında ne anlama geliyor döndü?

Edit:, bazı yerde çevresinde arama sonra ben sunucuda değişkenleri yansıtmak için bir PHP sınıfı yaratma yaklaşımını denemek düşündüm. Bu da işe yaramazsa.

class TimeZone {
    public function __construct ()
    {
        $this->timezone = 'ZULU';
    }
}

$WSDL = 'http://www.nanonull.com/TimeService/TimeService.asmx?WSDL';
$client = new SoapClient($WSDL, 
    array(
        "trace"      => 1,
        "exceptions" => 1,
        "soap_version" => SOAP_1_1
        ));

$xmlvar = new SoapVar(new TimeZone(), SOAP_ENC_OBJECT, "TimeZone");

$response = $client->getTimeZoneTime($xmlvar);

0 Cevap