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

给你一囗甜甜゛ 提交于 2019-12-25 18:14:52

问题


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>
  ...

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
...

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>
  ...

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!


回答1:


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>


来源:https://stackoverflow.com/questions/37573193/wso2esb-http-endpoint-throws-exception-when-using-uri-var-parameters-in-the-uri

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!