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

improve namespace prefix evaluation logic #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

isc-pfp
Copy link

@isc-pfp isc-pfp commented Sep 23, 2022

This is probably still not perfect. However, sending a request with a prefixed root and un-prefixed child element to a web-service does not work for me. And with this change, child elemnts are also prefixed, and the service call I am testing works now.

I tested this by generating a request for a webservice I am working on and then submitting it, using a IntellIJ .http file that I generated using the SOARequestCreator.createRequest() util method.

After this commit, the resulting request looks like this and works:

<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
  <s11:Body>
    <ns1:GetBusinessObject xmlns:ns1='http://client.example.com/xyz/v1'>
      <!-- from 0 to unbounded -->
      <ns1:objectId>0</ns1:objectId>
    </ns1:GetBusinessObject>
  </s11:Body>
</s11:Envelope>

Before this commit, the resulting request looks like this and does not work - the service implementation code sees an empty list [] of "objectId"s instead of [1]:

<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
  <s11:Body>
    <ns1:GetBusinessObject xmlns:ns1='http://client.example.com/xyz/v1'>
      <!-- from 0 to unbounded -->
      <objectId>0</objectId>
    </ns1:GetBusinessObject>
  </s11:Body>
</s11:Envelope>

FTR, the IntelliJ "request" in the test-service.http file I use, looks like this:

POST http://localhost:12345/xyz/XyzV1
Content-Type: text/xml

<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
...
</s11:Envelope>

This is probably still not perfect. However, sending a request with a prefixed root
and un-prefixed child element to a web-service does _not_ work for me. And with this
change, child elemnts are also prefixed, and the service call I am testing works now.

I tested this by generating a request for a webservice I am working on and then submitting it,
using a IntellIJ .http file that I generated using the SOARequestCreator.createRequest() util method.

After this commit, the resulting request looks like this and works:
    <s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
      <s11:Body>
        <ns1:GetBusinessObject xmlns:ns1='http://client.example.com/xyz/v1'>
          <!-- from 0 to unbounded -->
          <ns1:objectId>0</ns1:objectId>
        </ns1:GetBusinessObject>
      </s11:Body>
    </s11:Envelope>

Before this commit, the resulting request looks like this and does not work -
the service implementation code sees an empty list [] of "objectId"s instead of [1]:
    <s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
      <s11:Body>
        <ns1:GetBusinessObject xmlns:ns1='http://client.example.com/xyz/v1'>
          <!-- from 0 to unbounded -->
          <objectId>0</objectId>
        </ns1:GetBusinessObject>
      </s11:Body>
    </s11:Envelope>

FTR, the IntelliJ "request" in the test-service.http file I use, looks like this:
    POST http://localhost:12345/xyz/XyzV1
    Content-Type: text/xml

    <s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
    ...
    </s11:Envelope>
Copy link

@Pfiver Pfiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants