Hi

please refer the highlighted section

*expression="$func:message1/ser:request/xsd:symbol"* it always prints null
because, evaluation at *getEvaluatedParamValue *convert property to *string*
regardless of property element type

if '*$func:message1*' assigned back to another variable with OM type
started to evaluate correctly

<proxy xmlns="http://ws.apache.org/ns/synapse";
       name="Moo"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <enrich>
            <source type="body" clone="true"/>
            <target type="property" property="ORGINAL_MSG"/>
         </enrich>
         <property name="api.common.errorEntries"
                   expression="get-property('ORGINAL_MSG')"
                   type="OM"/>
         <clone>
            <target>
               <sequence>
                  <call-template target="HelloWorld_Logger">
                     <with-param name="message" value="Bonjour tout le
monde!!!!!!"/>
                     <with-param name="message1"
value="{$ctx:api.common.errorEntries}"/>
                  </call-template>
               </sequence>
            </target>
         </clone>
         <drop/>
      </inSequence>
   </target>
   <description/>
</proxy>

<template xmlns="http://ws.apache.org/ns/synapse"; name="HelloWorld_Logger">
   <parameter name="message"></parameter>
   <parameter name="message1"></parameter>
   <sequence>
      <log level="custom">
         <property xmlns:ns2="http://org.apache.synapse/xsd"; xmlns:ns="
http://org.apache.synapse/xsd"; name="CLONE-INNNNN"
expression="$func:message1"></property>
      </log>
      <property xmlns:ns2="http://org.apache.synapse/xsd"; xmlns:ns="
http://org.apache.synapse/xsd"; name="templateMessage"
expression="$func:message1" type="OM"></property>
      *<log>*
*         <property xmlns:xsd="http://services.samples/xsd
<http://services.samples/xsd>" xmlns:ns2="http://org.apache.synapse/xsd
<http://org.apache.synapse/xsd>" xmlns:ns="http://org.apache.synapse/xsd
<http://org.apache.synapse/xsd>" xmlns:ser="http://services.samples
<http://services.samples>" name="message##########"
expression="$func:message1/ser:request/xsd:symbol"></property>*
*      </log>*
   </sequence>
</template>

Please refer the configuration


    private Object getEvaluatedParamValue(MessageContext synCtx, String
parameter, Value expression) {
        if (expression != null) {
            if (expression.getExpression() != null) {
                if(expression.hasExprTypeKey()){
                if(expression.hasPropertyEvaluateExpr()){
                //TODO:evalute the string expression get the value
                //String evaluatedPath ="{//m0:getQuote/m0:request}";
                return expression.evalutePropertyExpression(synCtx);
                }
                    return expression.getExpression();
                } else {
                *    return expression.evaluateValue(synCtx);*
                }

            } else if (expression.getKeyValue() != null) {
                return expression.evaluateValue(synCtx);
            }
        }
        return null;
    }


public String evaluateValue(MessageContext synCtx) {

        if (keyValue != null) {

         return keyValue;

        } else if (expression != null) {

            //if dynamic key return evaluated value

         *   return expression.stringValueOf(synCtx);*

        } else {

            handleException("Can not evaluate the key: " +

                            "key should be static or dynamic key");

            return null;

        }

    }

public jira created

https://wso2.org/jira/browse/ESBJAVA-3517

cheers,
Dushan Abeyruwan | Associate Tech Lead
Integration Technologies Team
PMC Member Apache Synpase
WSO2 Inc. http://wso2.com/
Blog:http://dushansview.blogspot.com/
Mobile:(0094)713942042
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to