java ee - How exactly works this enrich mediator chained after a callou mediator in this ESB API flow? -
i new in wso2 , working on ei project involves esb , dss components.
i have following doubt correct meaning of section of api flow:
<?xml version="1.0" encoding="utf-8"?> <sequence name="cropnamessequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse"> <payloadfactory media-type="xml"> <format> <ds:findcropnames xmlns:ds="http://ws.wso2.org/dataservice"> <ds:sampleid>$1</ds:sampleid> </ds:findcropnames> </format> <args> <arg evaluator="xml" expression="$ctx:sampledata//ds:sample/ds:sample_id/text()" xmlns:ds="http://ws.wso2.org/dataservice"/> </args> </payloadfactory> <header name="action" scope="default" value="urn:findcropnames"/> <callout endpointkey="prgfasendpoint"> <source xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xpath="s11:body/child::*[fn:position()=1] | s12:body/child::*[fn:position()=1]"/> <target xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xpath="s11:body/child::*[fn:position()=1] | s12:body/child::*[fn:position()=1]"/> </callout> <enrich> <source clone="true" type="envelope"/> <target property="cropnames" type="property"/> </enrich> <log level="custom"> <property expression="$ctx:cropnames" name="crop names"/> </log> ........................................................................ ........................................................................ else ........................................................................ ........................................................................
in code performing following operation:
the first payloadfactory mediator used create message containing
<ds_sampleid>...</ds_sampleid>
parameter retrieved related xpath expression<args>...</args>
. message represents request wil send dss service.then specifying header name="action" specify name of dss service used obtain data db (the service name urn:findcropnames.
then using callout mediator perform request toward previous web service.
my doubts related following enrich mediator, one:
<enrich> <source clone="true" type="envelope"/> <target property="cropnames" type="property"/> </enrich>
in many example see after calling web service using callout mediator chaned enrich mediator.
from understandint meaning of specific mediator (in posted case) tacking envelope of web service response , copying new property name cropnames can use in flows, example can log content of property chaining:
<log level="custom"> <property expression="$ctx:cropnames" name="crop names"/> </log>
is interpretation correct or missing something?
this correct, property of type "om" (xml) created, it's name "cropnames" , belongs default scope (synapse scope) , can access thoses xpath : get-property('cropnames') or $ctx:cropnames
Comments
Post a Comment