在uri-template中使用uri.var参数时,WSO2ESB HTTP端点抛出异常

时间:2016-06-01 15:41:14

标签: wso2 wso2esb

我尝试使用以下配置调用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,表示&#34;不允许DOCTYPE&#34;:

[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参数起作用?谢谢!

1 个答案:

答案 0 :(得分:1)

如果您启用了线程日志,则可以找到您所引用的实际端点。请参阅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>