Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby mustUnderstand=";1“;在Savon安全头中_Ruby_Soap_Savon - Fatal编程技术网

Ruby mustUnderstand=";1“;在Savon安全头中

Ruby mustUnderstand=";1“;在Savon安全头中,ruby,soap,savon,Ruby,Soap,Savon,以下是服务应该是什么样子(从Soap UI): 但这会产生以下结果: <wsse:Security>mustUnderstand="1"</wsse:Security> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> mustUnderstand=“1” 这不是我想要的。关于如何进入w

以下是服务应该是什么样子(从Soap UI):

但这会产生以下结果:

<wsse:Security>mustUnderstand="1"</wsse:Security>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
mustUnderstand=“1”
这不是我想要的。关于如何进入wsse:Security元素(比如SoapUI)有什么想法吗

编辑:

根据Steffen的建议,我得到以下结果:

<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cmn="http://www.sircon.com/WebServices/services/OnboardingServices.wsdl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" soapenv:mustUnderstand="1">
  <soapenv:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1">
        <wsse:Username>26613</wsse:Username>
        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">NTcyN2QyNjliYmMxZjg2Yjc2YjA0MTY0NjE5MjdjZjQ4ZGY0YzlhYQ==
</wsse:Nonce>
        <wsu:Created>2015-02-25T21:28:53Z</wsu:Created>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">h8Qfcn6gA4swa/l+LmJR+RdCSto=</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>
  <soapenv:Body>
    <cmn:RecruiterOnboardingRequest>
      <some>key</some>
      <and>another one</and>
    </cmn:RecruiterOnboardingRequest>
  </soapenv:Body>
</soapenv:Envelope>

26613
NTCYN2QYNJLIYMMXZJG2YJC2YJA0MTY0NJE5MJDJQ4ZGY0YZLHYQ==
2015-02-25T21:28:53Z
h8Qfcn6gA4swa/l+LmJR+RdCSto=
钥匙

. 请随意查看以了解更多信息。

我认为您需要在客户端中定义名称空间,例如

client = Savon.client(
    wsdl: 'gofish?wsdl',
    pretty_print_xml: true,
    log: true,
    log_level: :debug,
    env_namespace: :soapenv,
    namespaces: {'soapenv:mustUnderstand' => "1"}
)
您可能还需要列出所需的所有其他名称空间

你可以尝试一些疯狂的事情。转到gem目录并找到该文件 …akami-1.2.2/lib/akami/wsse.rb

换行#158从


这并不漂亮,但它可能会工作

,但它不会将其插入到安全标头中,而是插入到soapenv:Envelope中。请参阅上面更新的输出。谢谢,我已经向Savon打开了一张罚单,看看是否可以获得一些指导。如果看起来更合适的话,请随意跟随或添加额外的输入。我认为你的建议会奏效,但正如你所说,这可能有点疯狂,会让我偏离主线,这总是有点令人担忧。是否有可能WSDL没有定义我在soapUI和Savon中看到的一些差异?公司给了我一些我加载的特殊soapUI文件。可能有额外的配置使它在那里工作?我已经接受了这一点,但如果其他同行遇到这一点,他们应该参考github问题,了解mustUnderstand是可选的。
<wsse:Security>mustUnderstand="1"</wsse:Security>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cmn="http://www.sircon.com/WebServices/services/OnboardingServices.wsdl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" soapenv:mustUnderstand="1">
  <soapenv:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1">
        <wsse:Username>26613</wsse:Username>
        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">NTcyN2QyNjliYmMxZjg2Yjc2YjA0MTY0NjE5MjdjZjQ4ZGY0YzlhYQ==
</wsse:Nonce>
        <wsu:Created>2015-02-25T21:28:53Z</wsu:Created>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">h8Qfcn6gA4swa/l+LmJR+RdCSto=</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>
  <soapenv:Body>
    <cmn:RecruiterOnboardingRequest>
      <some>key</some>
      <and>another one</and>
    </cmn:RecruiterOnboardingRequest>
  </soapenv:Body>
</soapenv:Envelope>
client = Savon.client(
    wsdl: 'gofish?wsdl',
    pretty_print_xml: true,
    log: true,
    log_level: :debug,
    env_namespace: :soapenv,
    namespaces: {'soapenv:mustUnderstand' => "1"}
)
:attributes! => { "wsse:Security" => { "xmlns:wsse" => WSE_NAMESPACE } }
:attributes! => { "wsse:Security" =>
                                       { "mustUnderstand" => "1",
                                         "xmlns:wsse" => WSE_NAMESPACE} }