【发布时间】:2015-09-17 21:29:49
【问题描述】:
我正在尝试实现一个序列模板,该模板利用参数调用端点模板。 我的代码如下:
序列-
<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。
【问题讨论】:
标签: templates wso2 wso2esb esb endpoint