hooklift / gowsdl

WSDL2Go code generation as well as its SOAP proxy
Mozilla Public License 2.0
1.16k stars 392 forks source link

Draft: Set namespace on request #212

Closed carlpett closed 8 months ago

carlpett commented 3 years ago

I'm working with a system which differentiates between <foo xmlns="something"> and <ns:foo xmlns:ns="something"> (which I believe are equivalent?). This patch sets up the namespace alias on the body such that it works for my usecase, by wrapping the request object.

Reviewer note: I'm not sure this is generally correct! It currently breaks the tests, but as far as I can tell it is mainly because the generated output is different. I'm unsure if it breaks other systems, eg when there shouldn't be a namespace at all, if that is something which could happen?

cc @c4milo

carlpett commented 3 years ago

For reference, this is a sample wsdl from the system I integrate with.

And this request doesn't work:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <!-- Header with token etc here -->
  <soap:Body>
    <Query xmlns="http://api.dcp.ericsson.net/UsageDataDownload">
      <!-- ... -->
    </Query>
  </soap:Body>
</soap:Envelope>

While this does:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <!-- Header with token etc here -->
  <soap:Body>
    <tns:Query tns:usag="http://api.dcp.ericsson.net/UsageDataDownload">
      <!-- ... -->
    </usag:Query>
  </soap:Body>
</soap:Envelope>
ieure commented 3 years ago

FYI, there's some overlap in this code with #218, which I wrote. From your description, we might be running into the same problem — it might be worth combining approaches.

carlpett commented 8 months ago

I'm no longer working on this, closing