如何在PHP中获取SOAP服务器函数名?

时间:2013-05-14 17:16:46

标签: php soap-client

我想获取soap服务器函数名称来放置变量数组并发送它但问题是我没有确切的函数名称,我正在寻找一种方法来测试它,所以我这样做了:

$options = array('username' => $this->user, 'password' => $this->pass);
$client = new SoapClient($this->wsdl_link, $options);

然后

print_r($client->__getTypes());

它返回:

Array
(
    [0] => struct SendSms {
 string username;
 string password;
 string from;
 ArrayOfString to;
 string text;
 boolean flash;
}
    [1] => struct ArrayOfString {
 string string;
}
    [2] => struct SendSmsResponse {
 ArrayOfString SendSmsResult;
}
    [3] => struct Credit {
 string username;
 string password;
}
    [4] => struct CreditResponse {
 double CreditResult;
}
    [5] => struct Delivery {
 string recId;
}
    [6] => struct DeliveryResponse {
 int DeliveryResult;
}
    [7] => struct MultiDelivery {
 ArrayOfString recId;
}
    [8] => struct MultiDeliveryResponse {
 ArrayOfInt MultiDeliveryResult;
}
    [9] => struct ArrayOfInt {
 int int;
}
    [10] => struct GetVirtualNumbers {
 string username;
 string password;
}
    [11] => struct GetVirtualNumbersResponse {
 ArrayOfString GetVirtualNumbersResult;
}
    [12] => struct GetPhoneGroups {
 string username;
 string password;
}
    [13] => struct GetPhoneGroupsResponse {
 ArrayOfString GetPhoneGroupsResult;
}
    [14] => struct SendToGroup {
 string username;
 string password;
 string from;
 ArrayOfInt groupIds;
 string text;
 boolean flash;
}
    [15] => struct SendToGroupResponse {
 int SendToGroupResult;
}
    [16] => struct ScheduledSend {
 string username;
 string password;
 string from;
 ArrayOfString to;
 ArrayOfInt groupIds;
 string text;
 boolean flash;
 int year;
 int month;
 int day;
 int hour;
 int minute;
}
    [17] => struct ScheduledSendResponse {
 int ScheduledSendResult;
}
    [18] => struct GetScheduleStatus {
 string username;
 string password;
 int scheduleId;
}
    [19] => struct GetScheduleStatusResponse {
 int GetScheduleStatusResult;
}
    [20] => struct RemoveScheduledSend {
 string username;
 string password;
 int scheduleId;
}
    [21] => struct RemoveScheduledSendResponse {
 int RemoveScheduledSendResult;
}
    [22] => struct GetInbox {
 string username;
 string password;
 string to;
 int year;
 int month;
 int day;
 int hour;
 int minute;
}
    [23] => struct GetInboxResponse {
 ArrayOfString GetInboxResult;
}
)

但是当我输入

$credit = $client->Credit();

我得到:

  

soap:Server Server无法处理请求。 --->宾语   引用未设置为对象的实例。 soap:Server Server是   无法处理请求。 --->对象引用未设置为   对象的实例。

我该怎么做才能获得功能名称?

编辑: 输出__getFunctions:

        Array
(
    [0] => SendSmsResponse SendSms(SendSms $parameters)
    [1] => CreditResponse Credit(Credit $parameters)
    [2] => DeliveryResponse Delivery(Delivery $parameters)
    [3] => MultiDeliveryResponse MultiDelivery(MultiDelivery $parameters)
    [4] => GetVirtualNumbersResponse GetVirtualNumbers(GetVirtualNumbers $parameters)
    [5] => GetPhoneGroupsResponse GetPhoneGroups(GetPhoneGroups $parameters)
    [6] => SendToGroupResponse SendToGroup(SendToGroup $parameters)
    [7] => ScheduledSendResponse ScheduledSend(ScheduledSend $parameters)
    [8] => GetScheduleStatusResponse GetScheduleStatus(GetScheduleStatus $parameters)
    [9] => RemoveScheduledSendResponse RemoveScheduledSend(RemoveScheduledSend $parameters)
    [10] => GetInboxResponse GetInbox(GetInbox $parameters)
    [11] => SendSmsResponse SendSms(SendSms $parameters)
    [12] => CreditResponse Credit(Credit $parameters)
    [13] => DeliveryResponse Delivery(Delivery $parameters)
    [14] => MultiDeliveryResponse MultiDelivery(MultiDelivery $parameters)
    [15] => GetVirtualNumbersResponse GetVirtualNumbers(GetVirtualNumbers $parameters)
    [16] => GetPhoneGroupsResponse GetPhoneGroups(GetPhoneGroups $parameters)
    [17] => SendToGroupResponse SendToGroup(SendToGroup $parameters)
    [18] => ScheduledSendResponse ScheduledSend(ScheduledSend $parameters)
    [19] => GetScheduleStatusResponse GetScheduleStatus(GetScheduleStatus $parameters)
    [20] => RemoveScheduledSendResponse RemoveScheduledSend(RemoveScheduledSend $parameters)
    [21] => GetInboxResponse GetInbox(GetInbox $parameters)
)

0 个答案:

没有答案