[英]wash_out: Accessing Soap Header
我需要模拟一个通过soap头接收身份验证凭据的soap服务。 有没有一种方法可以使用wash_out gem访问/解析肥皂头?
<SOAP-ENV:Header>
<ns:credentials xmlns:ns="http://somedomain.com/ws">
<ns:userID ns:encodingType="xsd:string">User</ns:userID>
<ns:password ns:encodingType="xsd:string">Password</ns:password>
</ns:credentials>
</SOAP-ENV:Header>
Wash_out仅支持WSSE(Web服务安全性)认证。
看起来像这样:
<soap:Header>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext">
<wsse:UsernameToken wsu:Id="sample"
xmlns:wsu="http://schemas.xmlsoap.org/ws/2003/06/utility">
<wsse:Username>sample</wsse:Username>
<wsse:Password Type="wsse:PasswordText">oracle</wsse:Password>
<wsu:Created>2004-05-19T08:44:51Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
我相信,如果您使用的是wash_out,则可以获取具有以下内容的标头(我没有尝试过此代码,我只是在查看https://github.com/inossidabile/wash_out/blob/master/lib/wash_out /dispatcher.rb
envelope = request.env['wash_out.soap_data'].values_at(:envelope, :Envelope).compact.first
header = envelope.values_at(:header, :Header).compact.first
userId = header.values_at(:userID, :UserID).compact.first
password = header.values_at(:password, :Password).compact.first
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.