Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

namespace mismatch #942

Open
sdahlbac opened this issue Oct 19, 2020 · 6 comments
Open

namespace mismatch #942

sdahlbac opened this issue Oct 19, 2020 · 6 comments
Labels

Comments

@sdahlbac
Copy link

Bug report

Given the following WSDL
AFO.wsdl.zip

and the following test code:

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'savon'
end

pp client = Savon.client(wsdl: 'AFO.wsdl', log: true, pretty_print_xml: true)

response = client.call(:lst_sindiv,
  message: {
    'SALMTS' => 1601886559308,
    'MLLMTS' => 1601886559887,
    'CALMTS' => 1601479482082,
    'CBLTMS' => 1601399512207
})

Produces the following request:

D, [2020-10-19T13:30:20.604164 #22041] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="http://your.company.net/AFO" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://your.company.net/AFO/LstSERSYM" xmlns:ins1="http://your.company.net/AFO/LstSSEITM" xmlns:ins2="http://your.company.net/AFO/LstSINDIV" xmlns:ins3="http://your.company.net/AFO/LstSGDIPO" xmlns:ins4="http://your.company.net/AFO/LstOCUSAD" xmlns:ins5="http://your.company.net/AFO/LstSASSTP" xmlns:ins6="http://your.company.net/AFO/LstSIPRIL" xmlns:ins7="http://your.company.net/AFO/LstSMETXT" xmlns:ins8="http://your.company.net/AFO/LstSITPOP" xmlns:ins9="http://your.company.net/AFO/LstSSJOBH" xmlns:ins10="http://your.company.net/AFO/LstMITPCE" xmlns:ins11="http://your.company.net/AFO/LstSGDMTX" xmlns:ins12="http://your.company.net/AFO/LstMITALT" xmlns:ins13="http://your.company.net/AFO/LstSSTYPE" xmlns:ins14="http://your.company.net/AFO/LstSSLINE" xmlns:ins15="http://your.company.net/AFO/LstZSUBPR" xmlns:ins16="http://your.company.net/AFO/LstSAGCON" xmlns:ins17="http://your.company.net/AFO/LstSINMTR" xmlns:ins18="http://your.company.net/AFO/LstFieldOpsSparePart" xmlns:ins19="http://your.company.net/AFO/LstFieldOpsRntAgrLine" xmlns:ins20="http://your.company.net/AFO/LstSPRICL" xmlns:ins21="http://your.company.net/AFO/LstCEAEMP" xmlns:ins22="http://your.company.net/AFO/LstSAGTYP" xmlns:ins23="http://your.company.net/AFO/LstSERCOD" xmlns:ins24="http://your.company.net/AFO/LstSTRVCD" xmlns:ins25="http://your.company.net/AFO/LstOCUSMA" xmlns:ins26="http://your.company.net/AFO/LstCSYTAB" xmlns:ins27="http://your.company.net/AFO/LstSALINE" xmlns:ins28="http://lawson.com/ws/credentials">
  <env:Body>
    <ns3:LstSINDIV>
      <ns3:SALMTS>1601886559308</ns3:SALMTS>
      <ns3:MLLMTS>1601886559887</ns3:MLLMTS>
      <ns3:CALMTS>1601479482082</ns3:CALMTS>
      <ns3:CBLTMS>1601399512207</ns3:CBLTMS>
    </ns3:LstSINDIV>
  </env:Body>
</env:Envelope>

In the WSDL:
xmlns:ns3="http://your.company.net/AFO/LstSINDIV"

in the request:

xmlns:ns3="http://your.company.net/AFO"

Current behavior:

Steps to reproduce current behavior:

Expected behavior:

The operation should be called with the correct namespace

System information:

  • ruby version: 2.6.5
  • savon version: 2.12.1
@olleolleolle
Copy link
Contributor

👋
Debugging ideas to describe the issue further:

  • add version numbers to gem "savon"
  • add gem "wasabi" and version numbers for it (see Wasabi issues list)

By travelling backwards in versions used, perhaps you can find a point in time where things didn't break?

@sdahlbac
Copy link
Author

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'savon', '2.12.1'
  gem 'wasabi', '3.6.1'
end

wsdl = Wasabi.document File.read("AFO.wsdl")
pp wsdl.namespace
pp wsdl.operations[:lst_sindiv]
pp wsdl.parser.namespaces[wsdl.operations[:lst_sindiv].fetch(:namespace_identifier)]

pp client = Savon.client(wsdl: 'AFO.wsdl', log: true, pretty_print_xml: true)

response = client.call(:lst_sindiv,
  message: {
    'SALMTS' => 1601886559308,
    'MLLMTS' => 1601886559887,
    'CALMTS' => 1601479482082,
    'CBLTMS' => 1601399512207
})

wasabi outputs:

"http://your.company.net/AFO"
{:action=>"LstSINDIV",
 :input=>"LstSINDIV",
 :output=>"LstSINDIVResponse",
 :namespace_identifier=>"ns3"}
"http://your.company.net/AFO/LstSINDIV"

which to me looks like wasabi probably does the correct thing

but the actual call is wrong.

Same result if I go back to e.g. (and the allowed minor combinations in between)
gem 'savon', '2.8.0'
gem 'wasabi', '3.3.0'

I wonder if savon is either overwriting ns3, or then just picking the namespace to use from targetNamespace instead of from the operation?

@sdahlbac
Copy link
Author

So as a workaround i can specify a global namespace option (unless having to use more than one), but it seems redundant having to do so.

@stale
Copy link

stale bot commented Dec 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 19, 2020
@AKoetsier
Copy link

I have the same issue. Even reverting to older versions of savon and/or wasabi doesn't help. Starting from version 2.8.0 savon at least uses the correct namespace id, in my case going from xmlns:ws to xmlns:ccma3. However it uses the wrong value for that namespace. It seems to use the targetNamespace from the wsdl.

@stale stale bot removed the stale label Jan 12, 2021
@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants