在基本的PHP/SOAP設置中遇到問題PHP SOAP函數調用返回錯誤
我在PHP中編寫SOAP客戶端以與現有SOAP服務器進行通信。它也使用WS-Security。
我已經成功地能夠連接(認證),並作出__getFunctions
調用,它返回使用下面的代碼可用功能的數組:
<?php
$wsdlPath = "https://xxx.xxx.xxx.xxx/services/Service?wsdl";
$ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
$token = new stdClass;
$token->Username = new SOAPVar('xUSERx', XSD_STRING, null, null, null, $ns);
$token->Password = new SOAPVar('xPASSx', XSD_STRING, null, null, null, $ns);
$wsec = new stdClass;
$wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, null, null, $ns);
$headers = new SOAPHeader($ns, 'Security', $wsec, true);
if (!$client)
{
$client = new SoapClient($wsdlPath);
echo "Conn:YES";
}
else
{
echo "Conn:NO";
}
$client->__setSOAPHeaders($headers);
try
{
print_r($client->__getFunctions());
}
catch (SoapFault $exception)
{
print($exception);
}
?>
這給下面的輸出(凌亂,但你這個想法):
Conn:YES
Array (
[0] => editChannelResponse editChannel(editChannel $parameters)
[1] => getDownloadTokenResponse getDownloadToken(getDownloadToken $parameters)
[2] => startCallResponse startCall(startCall $parameters)
[3] => getCallsResponse getCalls(getCalls $parameters)
[4] => endCalendarCallResponse endCalendarCall(endCalendarCall $parameters)
[5] => createChannelResponse createChannel(createChannel $parameters)
[6] => getArchivesByCallIdsResponse getArchivesByCallIds(getArchivesByCallIds $parameters)
[7] => getChannelsResponse getChannels(getChannels $parameters)
[8] => createVRRResponse createVRR(createVRR $parameters)
[9] => getTemplateResponse getTemplate(getTemplate $parameters)
[10] => getTemplatesResponse getTemplates(getTemplates $parameters)
[11] => getCallsByStatusResponse getCallsByStatus(getCallsByStatus $parameters)
[12] => getCallResponse getCall(getCall $parameters)
[13] => startCalendarCallResponse startCalendarCall(startCalendarCall $parameters)
[14] => deleteChannelResponse deleteChannel(deleteChannel $parameters)
[15] => editVRRResponse editVRR(editVRR $parameters)
[16] => deleteVRRResponse deleteVRR(deleteVRR $parameters)
[17] => getLiveStreamingsResponse getLiveStreamings(getLiveStreamings $parameters)
[18] => getHashedPasswordResponse getHashedPassword(getHashedPassword $parameters)
[19] => getVersionResponse getVersion(getVersion $parameters)
[20] => endCallResponse endCall(endCall $parameters)
[21] => getVRRsResponse getVRRs(getVRRs $parameters)
[22] => getNumberOfArchivesResponse getNumberOfArchives(getNumberOfArchives $parameters)
[23] => getArchivesResponse getArchives(getArchives $parameters)
[24] => getVRRResponse getVRR(getVRR $parameters)
)
但是,當我嘗試調用的上市功能直接(getVersion),一個通過更換
print_r($client->__getFunctions());
與
print_r($client->getVersion());
我收到以下錯誤
Conn:YES
SoapFault exception: [soap:Server]
Fault occurred while processing. in /var/data/www/xxx/beta/soap.php:29
Stack trace: #0 [internal function]: SoapClient->__call('getVersion', Array) #1
/var/data/www/xxx/beta/soap.php(29): SoapClient->getVersion() #2 {main}
我沒有看到錯誤消息的任何有用的信息,而我打電話的功能是列出的可用選項之一,我相信我的語法是正確的。
soap.php的第29行是什麼? – 2012-02-08 13:28:08
第29行是我對print_r($ client-> getVersion())進行更改的關鍵線路; – 2012-02-08 13:32:24
有沒有更多的堆棧跟蹤? – 2012-02-08 13:37:48