Pergunta

I'm creating an app that works with ServiceNow (custom reporting tool)

It's configured to use demo12 and XML service described here.

When i made this request

https://demo12.service-now.com/incident_list.do?XML&sysparm_query=opened_at%3E2012-04-17%2000:00:00%5Eopened_at%3C2012-04-18%2000:00:00%5E&sysparm_view=

in response XML i see not only <incident> nodes, but also <u_zprototype_incidents>

XPath to get node names is

distinct-values(/xml/*/name(.))

and result is (user-friendly formatted)

<XdmValue>
  <XdmAtomicValue>u_zprototype_incidents</XdmAtomicValue>
  <XdmAtomicValue>incident</XdmAtomicValue>
</XdmValue>

not sure, if this is how it should be displayed.

Is there any other way (extra URI param, etc.) to get valid XML (only <incident> nodes) ?

I know that i can use /xml/*[contains(name(.),'incident')][sys_id='my GUID'] to get needed nodes. but i think it consume more CPU time than just /xml/incident[sys_id='my GUID'].

Any ideas?

Foi útil?

Solução

For what it's worth, there's something atypical on that demo12 site. There are not supposed to be parent elements named "u_zprototype_incidents" by default. A custom table was created, extending the "incident" table, named "u_zprototype_incidents".

If you want to limit yourself ONLY to records in the base "incident" table, I would suggest that you simply add a new filter for "sys_class_name=incident". Giving you this URL:

https://demo12.service-now.com/incident_list.do?XML&sysparm_query=opened_at%3E2012-04-17%2000:00:00%5Eopened_at%3C2012-04-18%2000:00:00%5E^sys_class_name=incident&sysparm_view=

...With that you can use /xml/incident[sys_id='my GUID']

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top