我想向服务器发送下面的 xml 请求,该请求通过使用soap UI 发送正常,但在 php 中不行:
<ns:AgentLogin>
<ns:AgentLoginRQ>
<ns:Authentication>
<ns:DBName>************</ns:DBName>
<ns:IP>************</ns:IP>
</ns:Authentication>
<ns:AgentABTA>************</ns:AgentABTA>
<ns:UserName>************</ns:UserName>
<ns:Password>************</ns:Password>
</ns:AgentLoginRQ>
</ns:AgentLogin>
我像这样创建 SOAP 客户端
$client = new \SoapClient("https://digicom-poc-ota.inspiretec.com/TravelinkCEService.svc?wsdl");
这样就可以了,然后像这样创建 SOAP 调用函数
$data = array('AgentABTA'=>'DIGICOM_POC_DEMO'
,'UserName'=>'************'
,'Password'=>'************'
,'Products'=>'************'
);
$result = $client->__soapCall('AgentLogin',$data);
__soapcall 给我空请求正文的错误。
最佳答案
希望这可以帮助您:
$client = new \SoapClient("your_wsdl_link", [
'trace' => true
]);
$params = [
'AgentLoginRQ' => [
'DBName' => 'DATABASE_NAME',
'AgentABTA' => '****',
'UserName' => '****',
'Password' => '********',
'Products' => '',
]
];
$result = $client->YourFunction($params);
关于php - 如何在 __soapcall() 函数中的 php 中发送 SOAP 请求中的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51084546/