Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pass Security header in savon 2.7 with Rails 4

my require header is

<SOAP-ENV:Header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Security SOAP-ENV:mustUnderstand="1">
<wsse:UsernameToken>
<wsse:Username>123</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">1234</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header> 

this is my message :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:dictionary:com.test.webservices">
<soapenv:Body>
<urn:getPIN/>
</soapenv:Body>
</soapenv:Envelope>

my code

soap_header = {
        "wsse:Security" => {
            "@soapenv:mustUnderstand" => 1,
            "wsse:UsernameToken" =>{
                "Username"  => "123",
                "Password"  => "1234",
               "digest" => false
            }
        }
    }

client = Savon.client(wsdl: @wsdl, log: true,:ssl_verify_mode => :none,:soap_header=> soap_header)
response = client.call :getPIN, xml: @message

how to pass header in Savon 2.7 we not able to access services please help us.

like image 745
jayesh Avatar asked Nov 24 '25 20:11

jayesh


1 Answers

Try this please (found on Savon 2 documentation):

Savon.client(wsse_auth: ["123", "1234"])
like image 140
Dmitry Vershinin Avatar answered Nov 26 '25 09:11

Dmitry Vershinin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!