在 uri-template 中使用 uri.var 参数时,WSO2ESB HTTP Endpoint 抛出异常 [英] WSO2ESB HTTP Endpoint throws exception when using uri.var parameters in the uri-template

查看:28
本文介绍了在 uri-template 中使用 uri.var 参数时,WSO2ESB HTTP Endpoint 抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用以下配置调用 REST 端点:

I tried to invoke a REST endpoint by using the following configuration:

  ...
  <property name="uri.var.host" value="localhost:8080"/>
  <property name="uri.var.context" value="my-service"/>
  <call>
    <endpoint>
      <http method="POST" uri-template="http://{uri.var.host}/{uri.var.context}" />
    </endpoint>
  </call>
  ...

但随后我收到一个 XMLStreamException,显示不允许使用 DOCTYPE":

But then I get an XMLStreamException that says "DOCTYPE is not allowed":

[2016-06-01 17:16:15,702] ERROR - RelayUtils Error while building    Passthrough stream
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
...

另一方面,如果我不使用 uri.var 参数,它可以正常工作,即此配置有效:

On the other hand, it works without any issues if I don't use uri.var parameters, i.e. this configuration works:

  ...
  <call>
    <endpoint>
      <http method="POST" uri-template="http://localhost:8080/my-service"/>
    </endpoint>
  </call>
  ...

不幸的是,我需要使用 uri.var 参数,因为需要动态指定目标端点.所以问题是如何使 uri.var 参数起作用?谢谢!

Unfortunately, I need to use uri.var parameters since the target endpoint needs to be specified dynamically. So the question is how can I make uri.var parameters to work? Thanks!

推荐答案

如果您启用了线路日志,您可以找到您所指的实际端点.请参阅下文 示例请求.

If you enable the wirelog you can find what is the actual endpoint you are referring.see below sample request.

        <property name="uri.var.username" expression="$func:username"/>
    <call>
        <endpoint>
            <http method="get" uri-template="{+uri.var.apiUrl}/users/{+uri.var.username}/orgs"/>
        </endpoint>
    </call>

这篇关于在 uri-template 中使用 uri.var 参数时,WSO2ESB HTTP Endpoint 抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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