gpt4 book ai didi

php - SoapClient::SomeFunction 到 SoapClient::__soapCall ('SomeFunction' )

转载 作者:行者123 更新时间:2023-12-03 10:43:37 28 4
gpt4 key购买 nike

我以这种方式向 WSDL 服务器发送请求:

$soap = new SoapClient('WSDL_URI');
$soap->SomeFunction(array('Param1' => 123, 'Param2' => 456));

它工作正常,__getLastRequest 返回:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
<SOAP-ENV:Body>
<ns1:SomeFunction>
<ns1:Param1>123</ns1:Param1>
<ns1:Param2>456</ns1:Param2>
</ns1:SomeFunction>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

但是如果我通过 __soapCall 调用 SomeFunctionWSDL 服务器就会崩溃并且不会返回正确的响应。

$soap->__soapCall('SomeFunction', array('Param1' => 123, 'Param2' => 456));

__getLastRequest 返回:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
<SOAP-ENV:Body>
<ns1:SomeFunction/>
<param1>123</param1>
<param2>456</param2>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

你看,因为请求不一样,所以不行..

如何解决?

最佳答案

如php文档SoapClient::__soapCall所示,

    $client = new SoapClient("some.wsdl");

$client->SomeFunction($a, $b, $c);
// Or
$client->__soapCall("SomeFunction", array($a, $b, $c));

所以我认为如果你想用 __soapCall 调用网络服务,你应该这样调用:

$soap->__soapCall('SomeFunction', array(array('Param1' => 123, 'Param2' => 456)));

关于php - SoapClient::SomeFunction 到 SoapClient::__soapCall ('SomeFunction' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12009651/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com