我正在使用wso2esb4.7.0 我希望使用 wso2esb 添加 2 个数字,因为我已经编写了我的代理,但它不工作我的代理是这样的
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Addition"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="Value1"
expression="//Value1/text()"
scope="default"
type="STRING"/>
<property name="Value2"
expression="//Value2/text()"
scope="default"
type="STRING"/>
<property name="Result"
expression="fn:sum(get-property('Value1'),get-property('Value2'))"
scope="default"
type="STRING"/>
<log>
<property name="RESULT" expression="get-property('Result')"/>
</log>
</inSequence>
<outSequence/>
</target>
<description/>
</proxy>
我记录了它,结果给出了错误:
ERROR - SynapseXPath Evaluation of the XPath expression fn:sum(get-property('Value1'),get-property('Value2')) resulted in an error
org.jaxen.FunctionCallException: sum() requires one argument.
at org.jaxen.function.SumFunction.call(SumFunction.java:99)
at org.jaxen.expr.DefaultFunctionCallExpr.evaluate(DefaultFunctionCallExpr.java:177)
at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:102)
at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:674)
at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:213)
at org.jaxen.BaseXPath.evaluate(BaseXPath.java:172)
我也试过这个
<property name="Result"
expression="fn:sum(//Value1/text(),//Value2/text()))"
scope="default"
type="STRING"/>
Even this is also giving errors how would i reach to addition goal and my curl command like this
curl -v -H "Accept: application/json" -H "Content-Type:application/json" -H "ModifiedOn:0" -H "userid:-1899999899" -H "username:vikash|214057357158656" -H "password:gbadmin" -d '{"Value1":"2","Value2":"45"}' http://youtility2-desktop:8282/services/Addition