我是WS02的新手,但我很难找到一个url param并通过它。 关注Sending a Simple Message example
我的资源是
<resource methods="GET" uri-template="/wholesales/{dlrcode}">
<inSequence>
<log level="custom">
<property name="message" value="Whole sales request"/>
<property expression="/default/expression" name="p_dlrCode"/>
</log>
<send>
<endpoint key="WholeSales"/>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
我的END是
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="WholeSales" xmlns="http://ws.apache.org/ns/synapse">
<http method="get" uri-template="http://xxx/RDRSvc//vehicle/wholesaleD/{url.var.dlrcode}?format=json"/>
</endpoint>
但是当我打电话给api时
http://xxx.xx.xx.xx:8280/rdr/wholesales/42103
我看不到dlrCode ???
TID [-1234] [ESB] [2017-03-07 11:08:29,464] INFO {org.apache.synapse.mediators.builtin.LogMediator} - message =&#34;整个销售请求&#34; ,p_dlrCode =
如何将42103放入属性p_dlrCode? p>
答案 0 :(得分:1)
试试这个:
您的资源:
<resource methods="GET" uri-template="/wholesales/{dlrcode}">
<inSequence>
<log level="custom">
<property name="message" value="Whole sales request"/>
<property expression="get-property('uri.var.dlrcode')" name="p_dlrCode"/>
</log>
<send>
<endpoint key="WholeSales"/>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
您的终端已修复:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="WholeSales" xmlns="http://ws.apache.org/ns/synapse">
<http method="get" uri-template="http://xxx/RDRSvc//vehicle/wholesaleD/{uri.var.dlrcode}?format=json"/>
</endpoint>