Kbase P148512: Is it possible to pass a null value as an OpenEdge Native Services parameter if the XPath expression
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  21/01/2010 |
|
Status: Unverified
GOAL:
Is it possible to pass a null value as an OpenEdge Native Services parameter if the XPath expression for the Request Mapping fails ?
GOAL:
How to send a default value for the OpenEdge Native Services parameter if the XPath expression for the Request Mapping fails ?
GOAL:
How to prevent an exception to be thrown if an XML node which is required by an XPath expression is missing ?
FACT(s) (Environment):
OpenEdge 10.1C
OpenEdge 10.2x
All Supported Operating Systems
FIX:
XSLT or XPATH currently has no concept of a null value, but you can use the XPath 2.0 "Conditional Expression" in order to return a default value if the node does not exist. One way of doing this is inside an XSLT step before the OpenEdge Native Service step. The other way is to specify the XPATH expression directly in the Request Mapping for the OpenEdge Native Service step, for example:
if (/*[local-name()='Roundtrip']/*[local-name()='ipcText']/text())
then /*[local-name()='Roundtrip']/*[local-name()='ipcText']/text()
else 'empty'
if (/*[local-name()='Roundtrip']/*[local-name()='ipiNum']/text())
then /*[local-name()='Roundtrip']/*[local-name()='ipiNum']/text()
else '0'