Используя библиотеку Savon SOAP для Ruby, как я могу добавить общий атрибут env: mustUnderstand к тегу Security в заголовке запроса SOAP?По умолчанию он не включен в тег.
Вот мой текущий тестовый код:
require 'rubygems' require 'savon' client = Savon::Client.new do wsdl.document = File.expand_path("../service_wsdl.xml", __FILE__) end client.wsse.credentials "[removed]", "[removed]" p client.request :get_meta_data # Server returns 500 error (presumably due to improper header)
Вот отправляемый XML (который не включает mustUnderstandатрибут):
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:wsdl="urn:wsdl.ws.[removed].com/v1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ins0="urn:messages.ws.[removed].com/v1.1" xmlns:ins1="urn:objects.ws.[removed].com/v1.1" xmlns:ins2="urn:base.ws.[removed].com/v1.1" xmlns:ins3="urn:nullfields.ws.[removed].com/v1.1" xmlns:ins4="urn:generic.ws.[removed].com/v1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ins5="urn:metadata.ws.[removed].com/v1.1" xmlns:ins6="urn:faults.ws.[removed].com/v1.1" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env: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>[removed]</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">[removed]</wsse:Password> </wsse:UsernameToken> </wsse:Security> </env:Header> <env:Body> <GetMetaData/> </env:Body> </env:Envelope>