2017-09-24 212 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" }) 
相关问题