gowsdl icon indicating copy to clipboard operation
gowsdl copied to clipboard

Draft: Set namespace on request

Open carlpett opened this issue 3 years ago • 2 comments

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 avatar Jul 16 '21 21:07 carlpett

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>

carlpett avatar Jul 16 '21 21:07 carlpett

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.

ieure avatar Sep 28 '21 20:09 ieure

I'm no longer working on this, closing

carlpett avatar Mar 06 '24 07:03 carlpett