WebSphere Commerce extended XPath notation

WebSphere Commerce uses an extended XPath notation as the query language to identify the parts of the logical model you want to query. XPath is an industry standard language for addressing parts of an XML document, and the WebSphere Commerce extended XPath notation has some extensions to this standard.

The XML documents being addressed by the extended XPath notation are Business Object Documents (BODs), which are converted to a Java class called a Service Data Object (SDO). Each SDO object instance is represented as an element. Its properties can be represented as attributes (in simple case such as String) or as elements (when its properties reference another SDO object). Usually this XML document is governed by a XML schema which defines the allowable content and semantics. These SDO objects and XML schema form the WebSphere Commerce logical model.

When you use the XPath language, the XPath should match the logical schema of the response Noun. For example, given the following noun XML:

<Catalog>
    <CatalogGroup>
      <Name>MyCatalogGroupName</Name>
    </CatalogGroup>
  </Catalog>

The following example shows how to look up by Name:

/CatalogGroup[Name='MyCatalogGroupName']

the XPath expression matches the structure of the logical schema.

 

WebSphere Commerce extended XPath query notation

The syntax of specifying a query expression is shown here using the extended Backus-Naur Form notation:

Tip:

The control parameters part of the extended query expression allows the caller to specify additional information as part of the query. Use the control parameters when the query cannot be expressed by an XPath query. In other words, use these parameters if and only if the logical model cannot capture the conditions that express in the query.

For example, the caller of the Member component needs to retrieve information about the current user. The returned object is fetched based on the current userId stored in the command context. In this case, the 'self=true' name-value pair in the extended query expression can be used to indicate to the business logic additional information about the requested object. This information cannot be captured by the logical model. The query looks like this: {self=true;_wcf.ap=IBM_All}/Person.

 

Examples of query expressions

Search for organization by Distinguished Name (DN):

{_wcf.ap=IBM_All}/Organization[OrganizationIdentifier[(DistinguishedName='DN01')]]

The following example shows how to look up summary information about a catalog entry given its part number:

{_wcf.ap=IBM_Summary}/CatalogEntry[CatalogEntryIdentifier[ExternalIdentifier[(PartNumber='FU0101' or PartNumber='FU0102')]]]


Related Concepts


Get Request and the Show Response

Related tasks

Create a new search expression