Zend_Soap_Server - методы не отвечают

yavafree

Новичок
Всем привет.
Сделал на Zend - клиент и сервер.

Клиент
PHP:
<?php 
require_once 'Zend/Soap/Client.php';


$wsdlUri = 'http://localhost/webservice.php?wsdl';


try 
{
  $client = new Zend_Soap_Client($wsdlUri);
  $result = $client->test('Good ti7me for a fly');
  
  ?><html><body><?php
  echo $result;
  
  echo '<br/>';
  echo 'the end';
  
} 
catch (Exception $e) 
{
  echo 'Error: ' . $e->getMessage();
}




?>
</body></html>
и Сервер
PHP:
<?php 

require_once 'Zend/Loader.php';
require_once 'Zend/Config.php';
require_once 'Zend/Log.php';
require_once 'Zend/Log/Writer/Stream.php';
require_once 'Zend/Soap/Server.php';
require_once 'Zend/Soap/AutoDiscover.php';



/**
// 	* This method takes ...
// 	*
// 	* @param string $inputParam
// 	* @return string
// 	*/
function test($inputParam) 
{
	$logger = new Zend_Log();
	$writer = new Zend_Log_Writer_Stream('sample.log');
	$logger->addWriter($writer);
	$logger->log('Call WebService...', Zend_Log::INFO);

	$result = $inputParam;
    return  $inputParam;  
}



$wsdlUri = 'http://localhost/webservice.php?wsdl';


if(isset($_GET['wsdl'])) 
{
  $autodiscover = new Zend_Soap_AutoDiscover();
  $autodiscover->addFunction('test');
  $autodiscover->handle();
}
else 
{
  $soap = new Zend_Soap_Server($wsdlUri);
  $soap->addFunction('test');
  $soap->handle();
}

?>
Все работает.

<definitions name="webservice" targetNamespace="http://localhost/webservice.php"><types><xsd:schema targetNamespace="http://localhost/webservice.php"/></types><portType name="webservicePort"><operation name="test"><input message="tns:testIn"/><output message="tns:testOut"/></operation></portType><binding name="webserviceBinding" type="tns:webservicePort"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="test"><soap:eek:peration soapAction="http://localhost/webservice.php#test"/><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/webservice.php"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/webservice.php"/></output></operation></binding><service name="webserviceService"><port name="webservicePort" binding="tns:webserviceBinding"><soap:address location="http://localhost/webservice.php"/></port></service><message name="testIn"><part name="inputParam" type="xsd:string"/></message><message name="testOut"><part name="return" type="xsd:string"/></message></definitions>




Но когда хочу сервер проверить из браузера:
http://localhost/webservice.php/test?inputParam=asd

то выдается ерунда:

<SOAP-ENV:Envelope><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>Sender</faultcode><faultstring>Invalid XML</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>


В чем тут дело подскажите?
 

tz-lom

Продвинутый новичок
Soap передаёт запрос через тело запроса а не GET параметры
 

tz-lom

Продвинутый новичок
нет,не через POST , а именно тело запроса
почитайте википедию чтоли
 
Сверху