php - 肥皂。PHP 中的 XML 示例请求
问题描述
如何在 PHP 中实现 XML 示例请求?我对参数和发送 WS url 感到困惑......
例子:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="WS"> //here is my ws server URL
<soapenv:Header/>
<soapenv:Body>
<ws:calculatePrice>
<arg0 username="username" password="password">
<calculationInput var1="xxx" var2="xxx"/>
</arg0>
</ws:calculatePrice>
</soapenv:Body>
</soapenv:Envelope>
我试过这个,但没有成功。
<?php
try{
$soapclient = new SoapClient('WSDL'); //here is WSDL server
$result = $soapclient->calculatePremiumRegistered(array(
'arg0' => array('username' => 'username', 'password' => 'password'),
array('calculationInput' => array('var1' => 'xxx', 'var2' => 'xxx'))
));
print_r($result);
} catch(Exception $e){
echo $e->getMessage();
}
?>
我怎样才能正确地写出这些论点?如何发送 WS 服务器信息?
解决方案
推荐阅读
- stored-procedures - DB2 LUW - 在存储过程中获取错误行
- powershell - 从 60 天以前的路径中删除文件失败
- javascript - 从 Javascript 异步函数访问变量以进行排序
- python - Jupyter 和 %matplotlib 内联丢失轴
- reactjs - 测试自定义钩子的返回值
- kubernetes - 在 Airflow Cloud Composer 中从 Kubernetes Pod Operator 推送 Docker 镜像
- payment - Adyen,无需付款即可为信用卡创建令牌
- javascript - Typedoc 错误:尝试设置未声明的选项(模式)
- http-live-streaming - 使用 Stream/RAF Tester 调试 Roku 技巧模式
- c++ - 递归获取提升属性树中所有值的完整关键路径