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

Now supporting XSI namespace overrides #1079

Merged
merged 1 commit into from
Jun 20, 2019

Conversation

ddolcimascolo
Copy link
Contributor

Hey guys,

First thanks for this great lib, we're using it on production systems to query VMWare vSphere systems, it works nicely overall. To complete our CI pipeline we're executing real requests on a vSphere simulator that behaves slightly differently from a production system, see below:

Production system

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <QueryPerfResponse xmlns="urn:vim25">
      <returnval xsi:type="PerfEntityMetric">
        <entity type="HostSystem">host-72</entity>
        <sampleInfo>
          <timestamp>2019-06-17T14:28:40Z</timestamp>
          <interval>20</interval>
        </sampleInfo>
        <value xsi:type="PerfMetricIntSeries">
          <id>
            <counterId>1</counterId>
            <instance></instance>
          </id>
          <value>46</value>
        </value>
      </returnval>
    </QueryPerfResponse>
  </soapenv:Body>
</soapenv:Envelope>

Simulator

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <QueryPerfResponse xmlns="urn:vim25">
      <returnval xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance" XMLSchema-instance:type="PerfEntityMetric">
        <entity type="HostSystem">host-20</entity>
        <sampleInfo>
          <timestamp>2019-06-19T12:57:08.028417752Z</timestamp>
          <interval>20</interval>
        </sampleInfo>
        <value XMLSchema-instance:type="PerfMetricIntSeries">
          <id>
            <counterId>1</counterId>
            <instance></instance>
          </id>
        </value>
      </returnval>
    </QueryPerfResponse>
  </soapenv:Body>
</soapenv:Envelope>

The difference is that the simulator have its type in an overriden xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance" namespace and is not using the xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" namespace on the root element. This makes node-soap unable to find the associated complex type in the WSDL because it looks for a hardcoded xsi:type attribute to find the associated type.

In this Pull Request I'm adding auto-detection of XSI namespace and use {prefix}:type to find the type. I've added a unit test to cover the new feature, let me know if there's anything else.

Regards,
David

@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 93.378% when pulling 352e9b5 on stordata:xs-instance-support into d1c6a7e on vpulim:master.

@jsdevel jsdevel merged commit d4bc843 into vpulim:master Jun 20, 2019
@jsdevel
Copy link
Collaborator

jsdevel commented Jun 20, 2019

thanks!

@ddolcimascolo
Copy link
Contributor Author

Thx for the merge and the release :)

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.

3 participants