我尝试用PHP概述肥皂时出错

时间:2015-09-29 11:41:36

标签: php xml web-services soap

您好我在soap中有一些请求但是当我在我的网站上尝试请求时出现了一些错误。

致命错误:在第14行的/home/loraclec/public_html/pick5.php中调用非对象上的成员函数Body()

请求:

<?php
/** define the SOAP client using the url for the service**/
$SoapiClient = new soapclient('http://14.141.212.201/ConRsltAPI/Result.asmx?WSDL', array('trace' => 1));
$lStrCred = "GI2304CON15";
$lStrGameName = "PICK3";
$lstrStatus = "0";
$thearray = array(
    'lStrCred' => $lStrCred,
    'lStrGameName' => $lStrGameName, 
    'lstrStatus' => $lstrStatus
);
$result = $client->Body($thearray);

if (is_soap_fault($result)):

    echo '<h1>ERRROR</h1><pre>';

    print_r($result);

    echo '</pre>';

else:

    echo '<h1>Working FINE</h1><pre>';

    print_r($result);

    echo '</pre>';

endif;

// see the last SOAP request
echo htmlspecialchars($client->__getLastRequest(), ENT_QUOTES);

// print the SOAP response
echo htmlspecialchars($client->__getLastResponse(), ENT_QUOTES);

/** lets store the login token just in case we want to use it for later use**/

$token = $result->token;

?>

1 个答案:

答案 0 :(得分:0)

第14行

$client不存在。更改:

$result = $client->Body($thearray);

$result = $SoapiClient->Body($thearray);