Products Downloads


French version


 

You can use an XPATH query to designate a particular node or set of nodes in a tree structure. The XPATH syntax adopted for use in querying a Web service's complex result values is non-context-sensitive; the syntax merely defines an absolute path leading either to a leaf or to a multiple node ([]), or else to a node with which one or more attributes are associated.

 

The string that describes the query always begins with the "/" character. The same character is subsequently used as a separator between parent and child nodes. Node names are specific, depending on the definition of the complex result of the operation and Web service used. The relevant information can be displayed in the Object Manager's Modify a Web service dialog box.

Multiple nodes ([]) must have an index showing the number of the element between square brackets (this can be a numerical constant or a numerical variable).

 

Example:

The registration process for the GoogleSearch Web service declares three operations, including the doGoogleSearch operation.

This method has a complex result parameter (tree structure) called return.

The full tree structure of the result is shown below:

return

|_ Bool documentFiltering

|_ Alpha searchComments

|_ Entier estimatedTotalResultsCount

|_ Bool estimateIsExact

|_ resultElements

|   |_#[]

|       |_ Alpha summary

|       |_ Alpha URL

|       |_ Alpha snippet

|       |_ Alpha title

|       |_ Alpha cachedSize

|       |_ Bool relatedInformationPresent

|       |_ Alpha hostName

|       |_ Alpha hostName

|       |_ directoryCategory

|       |   |_ Alpha fullViewableName

|       |   |_ Alpha specialEncoding

|       |_ Alpha directoryTitle

|_ Alpha searchQuery

|_ Entier startIndex

|_ Entier endIndex

|_ Alpha searchTips

|_ directoryCategories

|    |_#[]

|       |_ Alpha fullViewableName

|       |_ Alpha specialEncoding

|_ Real searchTime

 

When consuming a Web service, the nodes for which a value can be returned are the leaf nodes in the tree structure. In the tree, such nodes are preceded by the type of the value returned. The value associated with one of these nodes can be retrieved using the WS_GET_VAL instruction.

 

To retrieve the value of the snippet leaf node, the following XPATH query is set as a parameter of the WS_GET_VAL instruction:

/return/resultElements/#[index]/snippet

The value returned is an ALPHA variable. As no exact length is specified by the Web service, the receiving variable must be of an appropriate size.

Note that the # node is a multiple node; as such, it must have an index. To determine the number of valid array elements for the # node, you must use the WS_COUNT_VAL instruction with the following XPATH query:

/return/resultElements/#

The value returned by the WS_COUNT_VAL instruction is always a numerical variable.

 

Note: Node names are case-sensitive.

 

↑ Top of page

  • Aucune étiquette