我创建的Zend_Soap_Server有问题。不知怎么的,服务器返回了这个:
HTTP/1.1 202 Accepted
Date: Sat, 14 Jun 2014 07:39:06 GMT
Server: Apache/2.2.22 (Debian)
X-Powered-By: PHP/5.4.4-14+deb7u10
Content-Length: 0
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
问题是,它应该有响应。我的意思是我应该得到一个标识符(见下文)。
我的代码:
class MyShorts {
[...]
/**
* Store a new URL into the database.
*
* @param string The URL to store
*
* @return string the unique identifier for this URL
*
* @exception for database errors.
*/
public function store($url) {
$db = $this->getDb();
while ( true ) {
try {
$identifier = $this->getRandomIdentifier(5);
$db->insert('urls', array('identifier' => $identifier,
'long' => $url,
'created' => new Zend_Db_Expr('NOW()'),
));
return $identifier;
}
catch( Exception $e ) {
throw $e;
}
}
return '';
}
在这里可以看到,它在数据库中存储一个url,并返回标识符。从我所看到的是,在数据库中,它是正确存储的。所以打电话之类的都没问题。
只是我没有得到标识符。这怎么可能呢?
谢谢!
BTW,我如何处理传入的请求:
$soap = new Zend_Soap_Server($WSDL);
$soap->setClass('MyShorts');
$soap->handle();
不知怎么的,上面描述的方法不起作用。然而起作用的是:
$soap = new Zend_Soap_Server(null, array('uri' => $WSDL));
显然,$WSDL是soap基础url的url,而不是WSDL了…