簡體   English   中英

wash_out:訪問肥皂標頭

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM