缺少 UsernameToken 元素
我在以下方法中收到请求,但肥皂消息似乎不包含 UsernameToken 元素:
$policy = new WSPolicy(
array(
'useUsernameToken'=>true
)
);
$security = new WSSecurityToken(
array(
'user'=>$username,
'passwordType'=>'PlainText',
'password'=>$password
)
);
// create client in WSDL mode
$client = new WSClient(
array (
'wsdl'=>$service_wsdl,
'to'=>$service_url,
'policy'=>$policy,
'securityToken'=>$security,
'trace'=>1
)
);
$proxy = $client->getProxy();
$proxy->Ping();
生成的请求如下所示:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ns1:Ping xmlns:ns1="http://streamlinedsalestax.org/efile"/>
</soapenv:Body>
</soapenv:Envelope>
您会注意到 UsernameToken 元素完全丢失。
I am getting a request in the following method but the soap message does not appear to contain the UsernameToken Element:
$policy = new WSPolicy(
array(
'useUsernameToken'=>true
)
);
$security = new WSSecurityToken(
array(
'user'=>$username,
'passwordType'=>'PlainText',
'password'=>$password
)
);
// create client in WSDL mode
$client = new WSClient(
array (
'wsdl'=>$service_wsdl,
'to'=>$service_url,
'policy'=>$policy,
'securityToken'=>$security,
'trace'=>1
)
);
$proxy = $client->getProxy();
$proxy->Ping();
The request that is produced looks like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ns1:Ping xmlns:ns1="http://streamlinedsalestax.org/efile"/>
</soapenv:Body>
</soapenv:Envelope>
You'll notice that the UsernameToken element is completely missing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个怎么样..向 WSPolicy 添加“安全”
how about this.. added 'security' to WSPolicy