WSO2 ESB:动态更改端点地址 [英] WSO2 ESB : DYNAMICALLY CHANGE ENDPOINT ADDRESS

查看:170
本文介绍了WSO2 ESB:动态更改端点地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何动态设置端点地址

我将端点地址设置为运行时的属性,需要替换端点的URI地址与它的价值。

i set endpoint address in to a property in run time and need to replace URI of endpoint address with it's value.

如何使用此值设置地址的URI值?

how can i set URI value of address with this value?

推荐答案

您可以像

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="MyEndpoint">
   <http uri-template="{uri.var.full}?f={uri.var.f}{+uri.var.extra}" method="put">
   </http>
</endpoint>

然后在调用端点MyEndpoint之前设置属性
..属性,端点的解析必须以uri开头。

Then before calling the endpoint 'MyEndpoint' set the properties .. the properties, to be parsed for an endpoint must begin with uri.

我还发现,如果你在属性名之前放一个+,那么它不会对它进行URI编码,所以它可以方便地在飞行中创建参数。否则,对于已知参数,您可以像上面那样对参数f进行类似的操作。

I also found out, that if you put a + before the property name, it doesn't URI encode it, so it's handy for creating parameters on the fly.. otherwise for known parameters, you can do like above for paramameter f

所以...像

<property name="uri.var.full" value="http://jarhedz.com/viewtopic.php"/>
<property name="url.var.f" value="2"/>
<property name="uri.var.extra" value="&t=39"/>
<send>
    <endpoint key="MyEndpoint"></endpoint>
</send>

应该带你到url http://jarhedz.com/viewtopic.php?f=2&t=39

(btw就像一个注释,如果你使用的网页编辑器,它会抱怨& ..它的buggy作为地狱..保存为

(btw just as a note, if you're using the web editor, it'll complain about the & .. its buggy as hell .. save it as

&amp; 

使用javascript将其保存为&或设置属性)

.. and that saves it as & or set the property using javascript )

这篇关于WSO2 ESB:动态更改端点地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆