In the From section, select any of the following options from the Type list:

Creating Oracle Mediator Routing Rules 19-25

19.2.2.10 What You May Need to Know About the Assign Activity

Note the following issues about the assign activity. ■ The assign activity is executed in the order that is present in the Oracle Mediator copy element. ■ A source XPath expression should always refer to a leaf node while the source is assigned to a target property. Otherwise, all the values of the child nodes in the source get concatenated and are assigned to the target property. Example 19–4 provides details. Example 19–4 XPath Expression Referring to a Leaf Node copy target=out.property.jca.file.FileName expression=in.bodyimp1:requestProductReqMake xmlns:imp1=http:xmlns.oracle.compsft XPath Expression below part level XPath Expression below part level copy expression=in.bodyimp1:requestProductRe qMake target=out.requestimp1:requestProductRe qModel xmlns:imp1=http:xmlns.oracle.compsft Table 19–3 Possibilities on Header Source Target Example XPath Expression below part level Property copy expression=in.header.inp1_ headerinp1:headerName target=out.property.jca.file.FileName xmlns:inp1=http:xmlns.oracle.compsft Property XPath Expression below part level copy value=in.property.jca.file.FileName target=out.header.inp1_ headerinp1:headerName xmlns:inp1=http:xmlns.oracle.compsft Constant XPath Expression below part level copy value=NewID.xml target=out.header.inp1_ headerinp1:headerId xmlns:inp1=http:xmlns.oracle.compsft Constant XPath Expression below part level copy value=sampleusername xmlns:wsse1=http:docs.oasis-open.orgwss 200401oasis-200401-wss-wssecurity-secext -1.0.xsd target=out.header.wsse1_ Securitywsse1:Securitywsse1:UsernameToken wsse1:Username XPath Expression XPath Expression copy target=out.header.inp1_header expression=in.header.inp1_header xmlns:inp1=http:xmlns.oracle.compsft XPath Expression below part level XPath Expression below part level copy target=out.header.inp1_ headerinp1:headerName expression=in.header.inp1_ headerinp1:headerId xmlns:inp1=http:xmlns.oracle.compsft Table 19–2 Cont. Possibilities on Payload Source Target Example 19-26 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite ■ While assigning a constant or a property to a target XPath expression, the target XPath expression should always point to a leaf node. Otherwise, nonleaf nodes contain only a string value that may generate nonvalid XML according to the .xsd file. Example 19–5 provides details. Example 19–5 Target XPath Expression Pointing to a Leaf Node copy target=out.requestinp1:requestProductReqMake value=NewMakeValue xmlns:inp1=http:xmlns.oracle.compsft In this example, out.requestinp1:requestProductReqMake refers to the leaf node. ■ If a transformation is available, then while assigning a source part to a target part, the target is overwritten because the assign activity occurs on top of the transformation. If the transformation is not available, then the assign activity creates the target. Example 19–6 provides details. Example 19–6 Transformation Availability and Assign Activity copy target=out.request expression=in.body copy target=out.header.inp1_header expression=in.header.inp1_header xmlns:inp1=http:xmlns.oracle.compsft ■ If one of the child nodes in the target payload has to be modified, then there are the following two use cases: – If a transformation is available, then directly assign a source expression to a target XPath expression that is pointing to that child node in the target. Example 19–7 provides details. Example 19–7 Direct Assignment of a Source Expression to a Target XPath Expression copy value=ConstantModel target=out.requestinp1:requestProductReqModel xmlns:inp1=http:xmlns.oracle.compsft – If a transformation is not available, then there are two steps involved. First, assign the source part to the target part, and then assign the source expression to a target XPath expression that is pointing to the child node in the target. Example 19–8 provides details. Example 19–8 Assignments if Transformations are Unavailable copy target=out.request expression=in.body and copy value=ConstantModel target=out.requestinp1:requestProductReqModel xmlns:inp1=http:xmlns.oracle.compsft ■ When only one of the child nodes of the source has to be propagated into a target, then first ensure that there is no transformation invoked. Then, assign the source XPath expression to point to the required child node. Example 19–9 provides details. Note: A leaf node is a node with no child nodes.