Web Service XML with node attributes generates ERROR

Started by mashedpotatorocket, December 04, 2023, 05:45:18 PM

Previous topic - Next topic

mashedpotatorocket

Hello.

I'm trying to collect data from a web service. The xml data has this format:

<?xml version="1.0" encoding="UTF-8"?>
<Result>
<UserStatus Status="2" StatusFrom="230904080005" ClientType="13,16" Device="tel:0123456789" TerminalCapabilities="1" DeviceStatusFrom="231204092543" OfficeDeviceStatusFrom="230918121327" MobileDeviceStatusFrom="231204092543" ServerTime="231204155632" DisplayName="Full Name">[email protected]</UserStatus>
</Result>

When using DCI parameter WebService1:/Result/UserStatus, I get [email protected] returned.
When trying to collect the value of an attribute, for example WebService1:/Result/UserStatus/Status, I get <<ERROR>> instead of the value 2.

Is the XML parser in NetXMS compliant with the XML standard?
When testing on xmlvalidation.com it says No errors were found, and this PowerShell oneliner demonstrates it should work:

([xml]'<Result><UserStatus Status="2"/></Result>').Result.UserStatus.Status


Thanks in advance.

Filipp Sudanov

current xml parsing code does not support this. In the future we will consider adding xms parsing library (same as we now have jq to parse json format). You can follow this ticket: https://track.radensolutions.com/issue/NX-2485

Currently you can enable "Process response as plain text" in properties of the web service and use a regex instead of path to get the value

Filipp Sudanov

XPath was added in 4.5.0, so you can try using this.

mashedpotatorocket

We upgraded to 4.5.3 today and had a new look on my Web Services. XPath is working perfectly. Thank you!