Hi Susinda, Please find comment inline.
> >> Suppose we have a sample payloadFactory configuration as follows >> >> <payloadFactory media-type="json"> >> <format>json body</format> >> <args> >> <arg evaluator="xml" expression="/person/gender"/> >> <arg value="2013"/> >> <arg evaluator="json" expression="$fname"/> >> </args> >> </payloadFactory> >> >> >> 1. Is there any use cases such that *media-type="json"* and <*arg >> evaluator="xml"* will be used >> > "media-type" is to specify the type which will be used to compose the outgoing payload (json/xml) and "evaluator" is used to specify the type of the expression (JsonPath/Xpath) used. UseCase : Incoming XML and need to send a Different Json payload to BE which consist of some values extracted from the incoming XML. 2. Possible use case of *media-type="xml"* and <*arg evaluator="json"*(opposite of the question one) >> > UseCase: when incoming payload is json and Steam Builders and Formatters are used, we use evaluator=json. The reason is, when the stream builders are enabled, content is set to a property JSON_STREAM and we have to extract the payload from that instead of taking it from the soap body. There we are using JsonPath to traverse the json object. > >> And some synapse code problems >> payloadFactoryMediator has has methods called getJsonPathArgumentList() >> and getXPathArgumentList(). I used these methods to access arguments, issue >> was the value type argument (<arg value="2013"/>) is returned from both >> methods. >> >> 3. Is this a bug or intended behavior. >> > This is an intended behavior. We only read the arguments in the synapse config once, when the PF initialize. Then keep the two argument types separately in two Lists and use the appropriate one for the scenarios accordingly. Eg: if xml -> PF -> xml, we use getXpath.. if json -> PF -> json and stream BnF are enabled, we use getJsonPath.. Values has to be there in both lists since it's common for both. >> And a suggestion >> 4 .How about giving the config something like follows (omitting the >> evaluator because in code level it is handled in that way). Hope this >> simplifies coding and understandability. >> <args> >> <arg expression="/person/gender"/> >> <arg value="2013"/> >> <arg jsonpath="$fname"/> >> </args> > > "evaluator" is used to distinguish different expression types. suppose we add more expression types in future, what makes more sense is keeping the arg type as expression and keep adding the different evaluator types. Thanks. -- Nalin Chamara Software Engineer na...@wso2.com +94715614756
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev