WSO2ESB HTTP 端点在 uri 模板中使用 uri.var 参数时抛出异常

WSO2ESB HTTP Endpoint throws exception when using uri.var parameters in the uri-template

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

  ...
  <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 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 参数,它可以正常工作,即此配置有效:

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

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

如果您启用 wirelog,您可以在 sample request.

下方找到您 referring.see 的实际端点
        <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>