0
我試圖實現一個序列模板,該模板使用參數調用端點模板。 我的代碼如下:Wso2 Esb序列模板調用端點模板
序列 -
<sequence xmlns="http://ws.apache.org/ns/synapse" name="aFileWriteSequence" trace="disable">
<log level="custom">
<property name="sequence" value="aFileWriteSequence"></property>
</log>
<property xmlns:ns="http://org.apache.synapse/xsd" name="filename" expression="get-property('transport', 'FILE_NAME')" scope="default" type="STRING"></property>
<call-template target="FileWriteTemplate">
<with-param name="targetFileName" value="A_TITLE"></with-param>
<with-param name="addressUri" value="vfs:file:///var/process/ren/rrout"></with-param>
</call-template>
</sequence>
序列模板 -
<template xmlns="http://ws.apache.org/ns/synapse" name="FileWriteTemplate">
<parameter name="targetFileName"></parameter>
<parameter name="addressUri"></parameter>
<sequence>
<log level="custom">
<property xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" name="TARGET_FILE_NAME" expression="$func:targetFileName"></property>
<property xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" name="ADDRESS_URI" expression="$func:addressUri"></property>
</log>
<property xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.ReplyFileName" expression="fn:concat($func:targetFileName, '-', get-property('SYSTEM_DATE', 'yyMMddHHmmss') , '.xml')" scope="transport" type="STRING"></property>
<property name="OUT_ONLY" value="true"></property>
<send>
<endpoint name="ep" template="FileOutEndpointTemplate" uri="$func:addressUri">
<axis2ns117:parameter xmlns:axis2ns117="http://ws.apache.org/ns/synapse" name="retries" value="3"></axis2ns117:parameter>
<axis2ns118:parameter xmlns:axis2ns118="http://ws.apache.org/ns/synapse" name="codes" value="1001"></axis2ns118:parameter>
<axis2ns119:parameter xmlns:axis2ns119="http://ws.apache.org/ns/synapse" name="factor" value="1.0"></axis2ns119:parameter>
</endpoint>
</send>
</sequence>
</template>
端點模板 -
<template xmlns="http://ws.apache.org/ns/synapse" name="FileOutEndpointTemplate">
<axis2ns131:parameter xmlns:axis2ns131="http://ws.apache.org/ns/synapse" name="codes"></axis2ns131:parameter>
<axis2ns132:parameter xmlns:axis2ns132="http://ws.apache.org/ns/synapse" name="factor"></axis2ns132:parameter>
<axis2ns133:parameter xmlns:axis2ns133="http://ws.apache.org/ns/synapse" name="retries"></axis2ns133:parameter>
<endpoint name="$name">
<address uri="$uri">
<suspendOnFailure>
<errorCodes>$codes</errorCodes>
<progressionFactor>$factor</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>$retries</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
</template>
我已經在嘗試在$ URI幾種變化特別是我無法讓它工作。從本質上講,這裏是我得到的錯誤:
2015-09-17 16:23:31,026 [-] [SynapseWorker-19] ERROR ClientUtils The system cannot infer the transport information from the $func:addressUri URL.
2015-09-17 16:23:31,026 [-] [SynapseWorker-19] ERROR Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: The system cannot infer the transport information from the $func:addressUri URL.
我將不勝感激任何建議,任何人都必須配置此行:
<endpoint name="ep" template="FileOutEndpointTemplate" uri="$func:addressUri">
尤其是如何addressUri正在從傳遞的參數代碼在我的序列中調用序列模板。
謝謝您的信息和建議Rajkumar!我已經實施了你的建議,而且效果很好。再次感謝! –