Hi All,
I tried to manipulate the result unfortunately no result return. Can anyone help me on this please?
declare @xmldata XML = '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 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>
<getDevicesResponse xmlns="urn:com.macrovision:flexnet/opsembedded">
<statusInfo>
<status>SUCCESS</status>
<reason>The following unsupported parameters were ignored : "deviceResponseConfig/features", "deviceResponseConfig/preBuiltLicense", "deviceResponseConfig/preBuiltProduct"</reason>
</statusInfo>
<responseData>
<device>
<deviceIdentifier>
<deviceType>SERVER</deviceType>
<deviceId>2214-SIS-OPS01_AYBGMUDE</deviceId>
<serverIds>
<serverId>2214-SIS-OPS01_AYBGMUDE</serverId>
<serverId xsi:nil="true"/>
</serverIds>
<deviceIdType>PUBLISHER_DEFINED</deviceIdType>
<publisherName>XYZ Corp</publisherName>
</deviceIdentifier>
<alias>2214-SIS-OPS01_AYBGMUDE</alias>
<hostTypeName>
<name>FLX_SERVER</name>
</hostTypeName>
<deviceStatus>ACTIVE</deviceStatus>
<channelPartners>
<channelPartner>
<tierName>bo.constants.partnertiernames.endcustomer</tierName>
<organizationUnit>
<uniqueId>2865576</uniqueId>
<primaryKeys>
<name>ZJ Co., Ltd. - 228177</name>
</primaryKeys>
</organizationUnit>
</channelPartner>
</channelPartners>
<soldTo>
<displayName>ZJ Co., Ltd. - 228177</displayName>
<id>228177</id>
<name>ZJ Co., Ltd. - 228177</name>
</soldTo>
<hasPrebuiltLicense>false</hasPrebuiltLicense>
<publisherIdName>
<name>XYZ Corp</name>
</publisherIdName>
<addonLineItemData>
<activationId>5CH0-SZYO-1F4WOH3D</activationId>
<enabledCount>1</enabledCount>
<consumedCount>1</consumedCount>
<licenseState>LICENSE_NOT_GENERATED</licenseState>
<entitledProducts>
<entitledProduct>
<product>
<uniqueId>191675</uniqueId>
<primaryKeys>
<name>In 2017 Runtime Tag without I/O</name>
<version>2017</version>
</primaryKeys>
</product>
<quantity>1</quantity>
</entitledProduct>
</entitledProducts>
</addonLineItemData>
<machineType>UNKNOWN</machineType>
</device>
<device>
<deviceIdentifier>
<deviceType>SERVER</deviceType>
<deviceId>4120WPV_Q11WK85Z</deviceId>
<serverIds>
<serverId>4120WPV_Q11WK85Z</serverId>
<serverId xsi:nil="true"/>
</serverIds>
<deviceIdType>PUBLISHER_DEFINED</deviceIdType>
<publisherName>XYZ Corp</publisherName>
</deviceIdentifier>
<alias>4120WPV_Q11WK85Z</alias>
<hostTypeName>
<name>FLX_SERVER</name>
</hostTypeName>
<deviceStatus>ACTIVE</deviceStatus>
<channelPartners>
<channelPartner>
<tierName>bo.constants.partnertiernames.endcustomer</tierName>
<organizationUnit>
<uniqueId>2867868</uniqueId>
<primaryKeys>
<name>TC - 253931</name>
</primaryKeys>
</organizationUnit>
</channelPartner>
</channelPartners>
<soldTo>
<displayName>TC - 253931</displayName>
<id>253931</id>
<name>TC - 253931</name>
</soldTo>
<hasPrebuiltLicense>false</hasPrebuiltLicense>
<publisherIdName>
<name>XYZ Corp</name>
</publisherIdName>
<addonLineItemData>
<activationId>DH8S-HV46-7DH4-6E3W</activationId>
<enabledCount>1</enabledCount>
<consumedCount>1</consumedCount>
<licenseState>LICENSE_NOT_GENERATED</licenseState>
<entitledProducts>
<entitledProduct>
<product>
<uniqueId>191271</uniqueId>
<primaryKeys>
<name>OEM In 2017 RT ag with I/O</name>
<version>2017</version>
</primaryKeys>
</product>
<quantity>1</quantity>
</entitledProduct>
</entitledProducts>
</addonLineItemData>
<machineType>UNKNOWN</machineType>
</device>
</responseData>
</getDevicesResponse>
</soapenv:Body>
</soapenv:Envelope>
'
;WITH XMLNAMESPACES(
'http://schemas.xmlsoap.org/soap/envelope/' as soapenv
)
SELECT
r.value('(deviceIdentifier/deviceType/text())[1]', 'varchar(100)') AS deviceType
,r.value('(deviceIdentifier/deviceId/text())[1]','varchar(100)') AS deviceId
,r.value('(soldTo/id/text())[1]','varchar(100)') AS soldTo
,r.value('(deviceIdentifier/deviceStatus/text())[1]','varchar(100)') AS deviceStatus
,r.value('(deviceIdentifier/channelPartners/channelPartner/organizationUnit/primaryKeys/Name/text())[1]','varchar(100)') AS channelPartners
FROM @xmldata.nodes('
/soapenv:Envelope/soapenv:Body/getDevicesResponse/responseData/device
') AS t1(r);
Many thanks.
Regards,
Micheale