使用API​​在附加链接中创建新租户

时间:2012-10-20 10:31:01

标签: php api

<?php

define( 'SITELINK_URL', "https://www.smdservers.net/CCWs_3.5/CallCenterWs.asmx?WSDL");
define( 'SITELINK_CORP_CODE', "CCTST" );
define( 'SITELINK_LOC_CODE', "Demo" );
define( 'SITELINK_CORP_LOGIN', "Administrator" );
define( 'SITELINK_CORP_PASS', "Demo" );


$client = new SoapClient( SITELINK_URL );
$params = new stdClass; // as stdClass
$params = array("sCorpCode" => SITELINK_CORP_CODE,"sLocationCode" =>SITELINK_LOC_CODE,"sCorpUserName" => SITELINK_CORP_LOGIN,"sCorpPassword" => SITELINK_CORP_PASS,"First_name" => "Rahul","Last_name" => "Singh");

try
{
$tenant = $client->TenantNew($params);
$tenantResult = $tenant->TenantNewResult->any;
}
catch (Exception $e )
{
    die( 'Error: '.$e->getMessage().'<br>'.$e );
}
  echo htmlentities($tenantResult);

?>

尝试使用上面的代码创建一个新租户,但它返回(-99)这是一个常规异常。 我在上面的代码中做错了什么。同样成功的我需要使用ReservationNew方法进行预订。请帮忙。感谢

1 个答案:

答案 0 :(得分:1)

这里的代码“有效”*。我查看了WSDL文件以查看它们用于各种参数的名称,并将“first_name”和“last_name”更改为“sTenantFirstName”和“sTenantLastName”

* by“working”我的意思是它给出了看起来更有意义的响应,而不仅仅是错误代码

参考:https://www.smdservers.net/CCWs_3.5/CallCenterWs.asmx?WSDL

<?php

define( 'SITELINK_URL', "https://www.smdservers.net/CCWs_3.5/CallCenterWs.asmx?WSDL"); 
define( 'SITELINK_CORP_CODE', "CCTST" );
define( 'SITELINK_LOC_CODE', "Demo" );
define( 'SITELINK_CORP_LOGIN', "Administrator" );
define( 'SITELINK_CORP_PASS', "Demo" );

$client = new SoapClient( SITELINK_URL );
$params->sCorpCode = SITELINK_CORP_CODE;
$params->sLocationCode = SITELINK_LOC_CODE;
$params->sCorpUserName = SITELINK_CORP_LOGIN;
$params->sCorpPassword = SITELINK_CORP_PASS;
$params->sTenantFirstName = "Rahul";
$params->sTenantLastName = "Singh";

try
{
    $tenant = $client->TenantNew( $params );
    $tenantResult = $tenant->TenantNewResult->any;
}
catch (Exception $e ) {
    die( 'Error: '.$e->getMessage().'<br>'.$e ); 
}

echo htmlentities($tenantResult);  

?>