savon
savon copied to clipboard
Breaking changes from 2.13.0
Bug report
We had to rollback to 2.12.0, I bisect the different and found that https://github.com/savonrb/savon/pull/943/files#diff-5a4c518121b3117561233cad78d43354f8424514a186ddd1459ab431178a667eR130-R137
introduced a breaking change on our side, our provide to which I don't have support neither code access do not support the updated payload. Is there a way to bypass this change aside of monkey patch the gem itself ?
Current behavior: SOAP calls are not accepted by our provider anymore
Steps to reproduce current behavior: Won't help much without the full payload but here is a sample
Wasabi::Document.new("https://sync.rex11.com/ws/v4staging/publicapiws.asmx?WSDL")
body = Savon::Builder.new('PickTicketAdd', Base::WSDL_OBJECT, Base::SAVON_GLOBAL_OPTION, {message: payload}).to_s
Expected behavior:
SOAP calls are accepted by our provider
System information:
- ruby version: 3.3.0
- savon version: 2.13.0
Thank you for the bisect but this doesn’t give me enough info to fix, and obviously I can’t just roll back that change since its a fix for https://github.com/savonrb/savon/issues/224
Can you at least provide the response from the server? What doesn’t it like? And an anonymized before/after of the structure of the payload
For your reference, our application, which recently upgraded from version 2.12 to 2.15.1, has encountered this problem.
Additional namespaces are added to the env:Envelope tag, causing the server to return an error, as shown below:
Savon::SOAPFault: (soap:Client) 12|Presentation|soap message header incorrect
from /usr/local/bundle/gems/savon-2.15.1/lib/savon/response.rb:132:in `raise_soap_and_http_errors!'
I compared the request content between versions 2.12 and 2.15.1 and manually adjusted the env:Envelope tag to make the namespaces exactly the same as they were in version 2.12, which resolved the issue.
Here is a conceptual example of how I did it:
@savon_client = Savon.client(
wsdl: wsdl,
namespace_identifier: :env,
namespace: "http://schemas.xmlsoap.org/soap/envelope/",
namespaces: NAMESPACES,
open_timeout: 300,
read_timeout: 300,
pretty_print_xml: true
)
request = @savon_client.build_request(
action,
message: message,
soap_header: header,
attributes: {}
)
xml_str = modify_envelope(request.body)
response = @savon_client.call(
action,
xml: xml_str
)
The envelope content with version 2.12:
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:add="http://www.w3.org/2005/08/addressing" xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:oas1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:awsse="http://xml.amadeus.com/2010/06/Session_v3">
The envelope content with version 2.15.1:
<env:Envelope
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:air_sellfromrecommendation_5_2="http://xml.amadeus.com/ITAREQ_05_2_IA" xmlns:air_sellfromrecommendationreply_5_2="http://xml.amadeus.com/ITARES_05_2_IA" xmlns:amasec="http://xml.amadeus.com/2010/06/Security_v1"
xmlns:awsl="http://wsdl.amadeus.com/2010/06/ws/Link_v1"
xmlns:awsse="http://xml.amadeus.com/2010/06/Session_v3" xmlns:fare_checkrules_7_1="http://xml.amadeus.com/FARQNQ_07_1_1A" xmlns:fare_checkrulesreply_7_1="http://xml.amadeus.com/FARQNR_07_1_1A" xmlns:fare_informativebestpricingwithoutpnr_15_1="http://xml.amadeus.com/TIBNRQ_15_1_1A" xmlns:fare_informativebestpricingwithoutpnrreply_15_1="http://xml.amadeus.com/TIBNRR_15_1_1A" xmlns:fare_informativepricingwithoutpnr_15_1="http://xml.amadeus.com/TIPNRQ_15_1_1A" xmlns:fare_informativepricingwithoutpnrreply_15_1="http://xml.amadeus.com/TIPNRR_15_1_1A" xmlns:fare_masterpricertravelboardsearch_17_3="http://xml.amadeus.com/FMPTBQ_17_3_1A" xmlns:fare_masterpricertravelboardsearchreply_17_3="http://xml.amadeus.com/FMPTBR_17_3_1A" xmlns:fare_pricepnrwithbookingclass_16_1="http://xml.amadeus.com/TPCBRQ_16_1_1A" xmlns:fare_pricepnrwithbookingclassreply_16_1="http://xml.amadeus.com/TPCBRR_16_1_1A" xmlns:minirule_getfrompricing_11_1="http://xml.amadeus.com/TMRCRQ_11_1_1A" xmlns:minirule_getfrompricingreply_11_1="http://xml.amadeus.com/TMRCRR_11_1_1A" xmlns:minirule_getfromrec_17_2="http://xml.amadeus.com/TMRXRQ_17_2_1A" xmlns:minirule_getfromrecreply_17_2="http://xml.amadeus.com/TMRXRR_17_2_1A" xmlns:pnr_addmultielements_16_1="http://xml.amadeus.com/PNRADD_16_1_1A" xmlns:pnr_cancel_16_1="http://xml.amadeus.com/PNRXCL_16_1_1A" xmlns:pnr_list_0_1="http://xml.amadeus.com/TNLRES_00_1_1A" xmlns:pnr_reply_16_1="http://xml.amadeus.com/PNRACC_16_1_1A" xmlns:pnr_retrieve_16_1="http://xml.amadeus.com/PNRRET_16_1_1A" xmlns:queue_placepnr_3_1="http://xml.amadeus.com/QUQPCQ_03_1_1A" xmlns:queue_placepnrreply_3_1="http://xml.amadeus.com/QUQPCR_03_1_1A" xmlns:security_authenticate_6_1="http://xml.amadeus.com/VLSSLQ_06_1_1A" xmlns:security_authenticatereply_6_1="http://xml.amadeus.com/VLSSLR_06_1_1A" xmlns:security_signout_4_1="http://xml.amadeus.com/VLSSOQ_04_1_1A" xmlns:security_signoutreply_4_1="http://xml.amadeus.com/VLSSOR_04_1_1A" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ticket_createtstfrompricing_4_1="http://xml.amadeus.com/TAUTCQ_04_1_1A" xmlns:ticket_createtstfrompricingreply_4_1="http://xml.amadeus.com/TAUTCR_04_1_1A" xmlns:tns="http://xml.amadeus.com"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:add="http://www.w3.org/2005/08/addressing"
xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:oas1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:awsse="http://xml.amadeus.com/2010/06/Session_v3">
The only difference is the envelope content; everything else seems the same as before.
Thanks - it looks like xmlns:awsse="http://xml.amadeus.com/2010/06/Session_v3" appears twice in the envelope you provided for 2.15.1 - does deduplicating that fix your issue? or can you say more about which specific attributes are causing the server error?
Thanks - it looks like
xmlns:awsse="http://xml.amadeus.com/2010/06/Session_v3"appears twice in the envelope you provided for 2.15.1 - does deduplicating that fix your issue? or can you say more about which specific attributes are causing the server error?
Thanks! by deduplicating that does fix the issue.
xmlns:awsse="http://xml.amadeus.com/2010/06/Session_v3" is added by namespaces option, and it is added again here