php - ns1:FailedAuthenticationThe security token could not be authenticated or authorized
问题描述
这是我用于身份验证的 xml 代码:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:esf="esf">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>my_username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">my_password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<esf:createSessionRequest>
<tin>my_bin</tin>
<x509Certificate>my_cert</x509Certificate>
</esf:createSessionRequest>
</soapenv:Body>
</soapenv:Envelope>
有连接到网站
try{ $CreateSession = $SessionService>__doRequest
($Create_session_xml, 'https://esf.gov.kz:8443/esfweb/ws/SessionService wsdl', '', SOAP_1_2);
echo $CreateSession;// here I get error: FailedAuthenticationThe security token could not be authenticated or authorized
} catch(SoapFault $e){
echo "Error: ".$e->getMessage().PHP_EOL;
}
我在这个网站上注册了,查了一下。所以我的数据没有问题。
有什么想法吗?请帮忙,我通过互联网搜索,没有结果。
编辑:从评论中获取的soap客户端的初始化。
$SessionService = new SoapClient(NULL, [
"location" => "esf.gov.kz:8443/esf-web/ws/SessionService",
"uri" => "esf-test.kgd.gov.kz:9443",
"style" => SOAP_DOCUMENT,
"use" => SOAP_LITERAL,
"stream_context" => $context
]);
解决方案
推荐阅读
- linux - 按 -name 和 -mtime 查找,不返回任何内容
- java - Pass object from a Class to Activity
- c++ - llvn 类型的类名后面的数字是多少?
- python - 我可以使用依赖于其他库的 kivy 构建 GUI 应用程序吗?
- android - Xamarin Forms - 创建任何人都可以访问的可访问文件夹
- python - 如何在 Python 中为文件操作分配 SSD?
- flutter - flutter - 如何在交错的 GridView 中实现刷新指示器
- javascript - 分析通过路径列表的函数
- c++ - 非常量隐式“转换”构造函数
- flutter - 从设置页面切换时间格式(上午/下午和 24 小时)