如何从 WSO2 EI Studio 调用外部 Rest API?
How to call external Rest API from WSO2 EI Studio?
我们需要从 WSO2 调用外部 rest API。所以
我已经单独创建了一个 spring 启动应用程序,它将数据存储到 postgres db.This 都是外部资源,我如何从 WSO2 调用此服务?我在网上找到的所有内容是我们可以在 WSO2 本身中创建 rest api。但我的要求不符合那个。请分享我需要在 WSO2 中完成的所有程序。
提前致谢
I have attached the image now which is the full use case
AddPerson.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="AddPerson" xmlns="http://ws.apache.org/ns/synapse">
<http method="post" uri-template="http://localhost:8080/wsoPOCApp/createPerson"/>
</endpoint>
这是我创建的端点,但当我通过 curl 命令点击它时它没有响应
我正在使用以下命令进行 curl
curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --data "@person-payload.json" http://192.168.0.109:8280/wsoPOCApp/createPerson
我也尝试使用 Postman 来点击它,但它给了我 404
C:\Users\User>curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --data "@person-payload.json" http://192.168.0.109:8280/wsoPOCApp/createPerson
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
This is the image from management console
您可以创建一个 HTTP 端点,配置 HTTP 方法,提供 URI,保存它。
在您的代码中,您要使用 Call/Send 调解器,并且必须在 Call/Send 调解器中指定您在上面创建的端点。
如果您已经有 WSO2 EI 代码,请更新您的问题,以便我提供准确的答案。
我们需要从 WSO2 调用外部 rest API。所以 我已经单独创建了一个 spring 启动应用程序,它将数据存储到 postgres db.This 都是外部资源,我如何从 WSO2 调用此服务?我在网上找到的所有内容是我们可以在 WSO2 本身中创建 rest api。但我的要求不符合那个。请分享我需要在 WSO2 中完成的所有程序。 提前致谢 I have attached the image now which is the full use case
AddPerson.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="AddPerson" xmlns="http://ws.apache.org/ns/synapse">
<http method="post" uri-template="http://localhost:8080/wsoPOCApp/createPerson"/>
</endpoint>
这是我创建的端点,但当我通过 curl 命令点击它时它没有响应 我正在使用以下命令进行 curl
curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --data "@person-payload.json" http://192.168.0.109:8280/wsoPOCApp/createPerson
我也尝试使用 Postman 来点击它,但它给了我 404
C:\Users\User>curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --data "@person-payload.json" http://192.168.0.109:8280/wsoPOCApp/createPerson
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
This is the image from management console
您可以创建一个 HTTP 端点,配置 HTTP 方法,提供 URI,保存它。
在您的代码中,您要使用 Call/Send 调解器,并且必须在 Call/Send 调解器中指定您在上面创建的端点。
如果您已经有 WSO2 EI 代码,请更新您的问题,以便我提供准确的答案。