2017-09-24 208 views
0

我從SOAP操作集成中收到此錯誤。 薩翁::的SOAPFault:(NS1:引發SecurityError)驗證消息爲什麼要求發送錯誤Savon :: SOAPFault:(ns1:SecurityError)

我薩翁客戶端這個樣子的時候遇到了安全錯誤:

client = Savon.client(wsdl: "https://212.154.167.194:9443/esf-web/ws/api1/SessionService?wsdl", 
     ssl_verify_mode: :none, 
     env_namespace: :soapenv, 
     pretty_print_xml: true, 
     namespace_identifier: :nam, 
     env_namespace: :soapenv, 
     namespaces: { "xmlns:nam" => "namespace.esf" }, 
     :raise_errors => true, 
     log: true, 
     #loglevel: :debug, 
     pretty_print_xml: true) 
     message = { 
    "createSessionRequest" => 
    { 
    "tin" => "placeholder", 
    "x509Certificate" => "placeholder" 
    } 
} 

和產生性反應

response = client.call(:create_session, message: {:tin => 'XXXX', :x509Certificate => 'xxxxxx'}) 

的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" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
     <wsse:UsernameToken wsu:Id="UsernameToken-664678CEF9FFC67AD214168421472821"> 
      <wsse:Username>123456789011</wsse:Username> 
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>    
     </wsse:UsernameToken> 
     </wsse:Security></soapenv:Header> 
    <soapenv:Body> 
     <esf:createSessionRequest> 
     <tin>?</tin> 
     <!--Optional:--> 
     <projectCode>?</projectCode> 
     <x509Certificate>?</x509Certificate> 
     </esf:createSessionRequest> 
    </soapenv:Body> 
</soapenv:Envelope> 

請幫忙

回答

0

在你有以下的用戶名和密碼的XML

<wsse:Username>123456789011</wsse:Username> 
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>    

在哪裏設定的用戶名和密碼?

Read the guide,讓你可以按照自己的步驟來配置薩翁:

response = client.call(:authenticate, message: { username: "luke", password: "secret" }) 
相關問題