我正在尝试在WSO2 ESB中自动部署API。我将.xml带有 de API 及其资源定义的文件放在 {ESB_HOME}/repository/deployment/server/synapse-configs/default/api/中,ESB 的 API Factory 部署它。
但是我收到此错误:
[2015-04-29 11:19:18,013] ERROR - APIFactory An API must contain at least one resource definition [2015-04-29 11:19:18,017] ERROR - APIDeployer API deployment from the file : /home/sergio/Escritorio/wso2esb-4.8.1/repository/deployment/server/synapse-configs/default/api/prueba.xml : Failed. org.apache.synapse.SynapseException: An API must contain at least one resource definition
XML 定义为:
<?xml version="1.0" encoding="UTF-8"?><api name="apps" context="/services/services/app"><resource methods="GET" uri-template="/get/{codigoApp}"><inSequence><send><endpoint><http method="get" uri-template="http://localhost:8080/services/services/app"/></endpoint></send></inSequence></resource><resource methods="GET" uri-emplate="/getAll"><inSequence><send><endpoint><http method="get" uri-template="http://localhost:8080/"/></endpoint></send></inSequence> </resource></api>
我可以在 WSO2 ESB 的管理面板中部署此 api 定义。
知道吗?
谢谢塞吉奥。
创建一个包含应用程序的文件.xml并将该文件放入 ESB_HOME/repository/deployment/server/synapse-configs/default/api
<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://ws.apache.org/ns/synapse"
name="apps"
context="/services/services/app">
<resource methods="GET" uri-template="/get/{codigoApp}">
<inSequence>
<send>
<endpoint>
<http method="get" uri-template="http://localhost:8080/services/services/app"/>
</endpoint>
</send>
</inSequence>
</resource>
<resource methods="GET">
<inSequence>
<send>
<endpoint>
<http method="get" uri-template="http://localhost:8080/"/>
</endpoint>
</send>
</inSequence>
</resource>
</api>