0
任何人都可以幫我解決我的問題嗎? 我試圖從我的Web服務獲取數據,有時服務器響應無效的XML。 我注意到它取決於數據大小。當響應達到一定大小時,以</SOAP-ENV:Envelop
而不是</SOAP-ENV:Envelope>
結束。肥皂響應錯誤(Yii網絡服務)
這是我的示例代碼:客戶端和服務器在一個控制器中。 方法「成功」工作正常,但類似的方法「失敗」沒有。 甚至更多:對於nginx和php-fpm「成功」的方法也失敗了(對於php_mod「成功」方法工作的Apache)。
<?php
class SoapController extends CController
{
public function actions()
{
return array('wsdl' => array('class' => 'CWebServiceAction'));
}
private function getData($size)
{
return array_fill(0, $size, '18ad96e6-5526-11e0-9c19-00248c654095');
}
/**
* @return array
* @soap
*/
public function success()
{
return $this->getData(104);
}
/**
* @return array
* @soap
*/
public function fail()
{
return $this->getData(105);
}
public function actionTest()
{
$client = new SoapClient($this->createAbsoluteUrl('wsdl'), array('trace' => true));
$methods = array('success', 'fail');
foreach ($methods as $method) {
try {
$result = call_user_func(array($client, $method));
$result = count($result);
} catch (SoapFault $ex) {
$result = $ex->getMessage();
}
echo $method . ' result: ' . $result . '<br>';
echo $method . ' response: <br>' . htmlspecialchars($client->__getLastResponse()) . '<br><br>';
}
}
}
軟件版本:
- Ubuntu服務器12.10
- 的Yii 1.1.13
- PHP 5.4.6
- 的Apache 2.2.22
- Nginx的1.2.1