Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Url rewriting WSO2 ESB URL重写没有效果?_Url Rewriting_Wso2_Wso2esb - Fatal编程技术网

Url rewriting WSO2 ESB URL重写没有效果?

Url rewriting WSO2 ESB URL重写没有效果?,url-rewriting,wso2,wso2esb,Url Rewriting,Wso2,Wso2esb,我试图用URLEwrite中介修改URL,但似乎没有效果 我想将单词“user1”替换为“customer1”,然后将请求发送到端点 在我的代理中,我收到以下URL: “/services/myproxy/user1” 我必须把它改写成: “/services/myproxy/customer1”(然后是endpont:”) URLRewrite中介是: <rewrite xmlns="http://ws.apache.org/ns/synapse"> <rewriter

我试图用URLEwrite中介修改URL,但似乎没有效果

我想将单词“user1”替换为“customer1”,然后将请求发送到端点

在我的代理中,我收到以下URL:

“/services/myproxy/user1”

我必须把它改写成:

“/services/myproxy/customer1”(然后是endpont:”)

URLRewrite中介是:

<rewrite xmlns="http://ws.apache.org/ns/synapse">
   <rewriterule>
      <action value="customer1" regex="user1" type="replace" fragment="path"/>
   </rewriterule>
</rewrite>

但在最后,代理发送URL请求时使用“user1”而不是“customer1”

我的配置有什么问题??我在日志中没有看到任何错误


谢谢

下面的语法非常适合我。您正在使用的ESB版本是什么

<rewrite>
         <rewriterule>
            <action value="customer1" regex="user1" type="replace" fragment="path"/>
         </rewriterule>
      </rewrite>
      <send/>

我也有类似的问题。在我的例子中,在重写URL之后,我没有将
outProperty
设置回
REST\u URL\u POSTFIX
。希望这能帮助将来有同样问题的人

<sequence>
  <property name="REST_URL_POSTFIX" expression="get-property('axis2','REST_URL_POSTFIX')"/>
  <rewrite inProperty="REST_URL_POSTFIX" outProperty="REST_URL_POSTFIX">
    <rewriterule>
      <action fragment="path" type="replace" regex="^/soap/sms" value="/sms" />
    </rewriterule>
  </rewrite>
  
  <property name="REST_URL_POSTFIX" scope="axis2" expression="get-property('REST_URL_POSTFIX')"/>
  ^^ Make sure to set this back ^^
</sequence>

^^一定要把这个往后退^^

您能分享一下您的完整序列吗?我正在使用4.7.0和4.6.0。也许我需要修改端点?或者将发送中介与特定配置一起放置?我的意思是,上面的语法可以工作,但在代理将请求发送到端点时不应用。您所说的“上面的语法可以工作,但在代理将请求发送到端点时不应用”是什么意思?这是自相矛盾的。如果上述语法有效,则消息应该路由到正确的端点。您可以通过这个示例简单地测试这一点。