【发布时间】:2016-10-29 08:36:30
【问题描述】:
我正在尝试请求服务。
这里是wsdl文件WSDL的链接
这是代码
$client = new SoapClient("http://zelsoft.ru/intourxml_v2/BookingService.asmx?WSDL", array(
'soap_version'=> SOAP_1_2,
'exceptions' => 1,
));
$xml = <<<XML
<GetReferenceRq>
<Login>Zelsoft</Login>
<Password>zel123</Password>
<Countries>true</Countries>
<Regions>true</Regions>
</GetReferenceRq>
XML;
$struct = new SoapVar($xml,XSD_ANYXML,"GetReferenceRq");
try{
echo "<pre>";
print_r($client->__getFunctions());
print_r($client->GetReference($struct));
echo "</pre>";
} catch(Exception $e){
echo $e->getMessage();
}
但我得到一个错误
Function ("GetReference") is not a valid method for this service
$client->__getFunctions()
表示方法存在
感谢回答
更新
我通过将soap.wsdl_cache_enabled设置为0解决了这个问题,但是又遇到了一个问题
我正在使用这样的代码发送请求
$client = new SoapClient("http://zelsoft.ru/intourxml_v2/BookingService.asmx?WSDL", array(
'soap_version'=> SOAP_1_2,
'exceptions' => 1,
));
class GetReferenceRq{
public $Login = 'Zelsoft';
public $Password = 'zel123';
}
try{
echo "<pre>";
print_r($client->GetReference(new GetReferenceRq()));
echo "</pre>";
} catch(Exception $e){
echo $e->getMessage();
}
但得到回应
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Zelsoft.InTourXML.BusinessLogic.Base.GetBaseRqParams(SqlConnection cnn, BaseRq rq)
at Zelsoft.InTourXML.BusinessLogic.Base.Connect(BaseRq rq)
at Zelsoft.InTourXML.BusinessLogic.Reference.GetReference(GetReferenceRq rq)
at Zelsoft.InTourXML.BookingService.GetReference(GetReferenceRq rq)
--- End of inner exception stack trace ---
【问题讨论】:
标签: php web-services soap wsdl