我用rest api检索数据,但在这种情况下,我有soap api,我必须从那里获取用于自动填充表格的数据,我不知道在php中使用soap api。
样品申请:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xro="http://x-road.eu/xsd/xroad.xsd" xmlns:iden="http://xroad.eu/xsd/identifiers" xmlns:prod="http://arireg.x-road.eu/producer/">
<soapenv:Body>
<prod:lihtandmed_v2>
<prod:keha>
<prod:ariregister_kasutajanimi>kasutajanimi</prod:ariregister_kasutajanimi>
<prod:ariregister_parool>parool</prod:ariregister_parool>
<prod:ariregistri_kood>70000310</prod:ariregistri_kood>
</prod:keha>
</prod:lihtandmed_v2>
</soapenv:Body>
</soapenv:Envelope>
端点WSDL: https://ariregxmlv6.rik.ee/?wsdl
XSD:http://www2.rik.ee/schemas/xtee6/arireg/live/xroad6_lihtandmed_v2.xsd
代码:
ini_set('memory_limit','2048');
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);
ini_set('display_errors',true);
error_reporting(-1);
try {
$options = [
'trace' => true,
'exceptions' => true,
'connection_timeout' => 1
];
$tcs = new SoapClient("https://ariregxmlv6.rik.ee/?wsdl",$options);
$send = $tcs->__soapCall('lihtandmed_v2',[
'parameters' => [
'keha' => array(
"ariregister_kasutajanimi" => 'secretusername',
"ariregister_parool" => 'secretpassword',
"ariregistri_kood" => '70000310'
)
]
]);
print_r($send);
} catch (SoapFault $exception) {
echo $exception;
}
错误:SoapFault异常:[HTTP]无法连接到/var/www/public/index2.php:19堆栈跟踪:#0 [内部函数]:SoapClient-> __ doRequest('__ soapCall('lihtandmed_v2' ,数组)#2 {main}