我正在尝试使用Zend_Soap_ClientZend Framework v1.9.0中的来连接到Java Web服务:
include( 'Zend/Loader/Autoloader.php');
$autoloader = Zend_Loader_Autoloader::getInstance();
$client = new Zend_Soap_Client('https://webservice.com/webservice-war/webservice?wsdl'
, array('encoding'=> 'UTF-8'));
try{
$result = $client->find_customer(array('username' => 'user',
'password' => '123'), array('city' => 'some city'));
} catch(Exception $e){
echo $e;
}
echo '
' . $client->getLastRequestHeaders() . '';
?>
输出:
SoapFault exception: [HTTP] Unsupported Media Type in
/Library/ZendFramework-1.9.0/library/Zend/Soap/Client.php:937
Stack trace:
#0 [internal function]:
SoapClient->__doRequest('_doRequest(Object(Zend_Soap_Client_Common),
'__doRequest('__soapCall('find_customer', Array, NULL, NULL, Array)
#6 [internal function]:
Zend_Soap_Client->__call('find_customer', Array)
#7 /Users/webservicetest/index.php(8):
Zend_Soap_Client->find_customer(Array, Array)
#8 {main}
POST /webservice-war/webservice HTTP/1.1
Host: webservice.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.6
Content-Type: application/soap+xml; charset=utf-8; action=""
Content-Length: 315
知道有什么问题吗?网址是正确的,因为调用时我得到了可用的功能
$client->getFunctions()
本文尝试使用 Zend_SOAP_Client 从 Zend Framework v1.9.0 连接到 Java Web 服务时遇到问题。具体错误为 UnsupportedMediaType,在尝试调用 find_customer 方法时触发异常。
2054

被折叠的 条评论
为什么被折叠?



