WSO2 ESB中的自动部署API错误

时间:2015-04-29 09:34:05

标签: api wso2 wso2esb synapse

我正在尝试自动在WSO2 ESB中部署API。我将带有de API的.xml文件及其资源定义放在{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定义。

有什么想法吗?

谢谢, 塞尔吉奥。

1 个答案:

答案 0 :(得分:1)

使用apps.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>