英文:
back-end orchestration service in WSO2
问题
我遵循了这个教程来稍微了解如何在WSO2中开发服务编排,但仍然有一些问题。
好的,在最后,在第5步中,指示如何测试用例以运行编排,步骤如下:
- 下载后端服务的JAR文件。
- 打开终端并导航到保存后端JAR服务的目录。
- 使用以下命令执行后端服务的JAR文件:
java -jar Hospital-Service-JDK11-2.0.0.jar
然后,使用"Postman API"进行测试,使用以下请求信息:
- 方法:"POST"
- 标头:"Content-Type=application/json"
- URL:http://localhost:8290/healthcare/categories/surgery/reserve
- JSON格式请求体:
{
"name": "John Doe",
"dob": "1940-03-19",
"ssn": "234-23-525",
"address": "California",
"phone": "8770586755",
"email": "johndoe@gmail.com",
"doctor": "thomas collins",
"hospital": "grand oak community hospital",
"cardNo": "7844481124110331",
"appointment_date": "2025-04-02"
}
当我点击"发送"按钮时,API执行正确,我可以确认这一点,因为在POSTMAN中我得到以下响应:
JSON响应中的代码如下:
{
"patient": "John Do",
"actualFee": 7000.0,
"discount": 20,
"discounted": 5600.0,
"paymentID": "5988f2a0-4d43-436b-9df8-703ffd75bfcb",
"status": "Settled"
}
我的问题是,"patient"、"actualFee"、"discount"、"discounted"、"paymentID"和"status"变量是从哪里获得的?我不记得在教程中声明这些变量,所以这些变量是从JAR后端服务中获得的吗?理解WSO2中这种类型的编排功能对我非常重要,我只了解M.U.L.E.与Spring TS接口,这是我第一次使用WSO2,如果有人能为我提供指导,我将不胜感激,我在WSO2中感到有些混乱。
英文:
i followed this tutorial for little bit understand how develop a service orchestration in WSO2, but still have a any questions.
Ok,in the end, in the 5 step, indicate how do test the use case so run the orchestration, the steps are the next:
<br>1.-Download a JAR file of the back-end service.
<br>2.-Open a terminal and navigate to the direcotory where is saved the back-end JAR service.
<br>3.-Execute the JAR file back-end service with the next line:
java -jar Hospital-Service-JDK11-2.0.0.jar
and then using "Postman API" do a test with the next request information:<br>
1.- Method: "POST"
<br>2.- Headers " Content-Type=application/json "
<br>3.- URL: http://localhost:8290/healthcare/categories/surgery/reserve
<br>4.- JSON format body:
{
"name": "John Doe",
"dob": "1940-03-19",
"ssn": "234-23-525",
"address": "California",
"phone": "8770586755",
"email": "johndoe@gmail.com",
"doctor": "thomas collins",
"hospital": "grand oak community hospital",
"cardNo": "7844481124110331",
"appointment_date": "2025-04-02"
}
and i when click Send button the API do correctly, i can confirme this why in the POSTMAN i get the next response:
JSON Response
The response in code in JSON code is this:
{
"patient": "John Do",
"actualFee": 7000.0,
"discount": 20,
"discounted": 5600.0,
"paymentID": "5988f2a0-4d43-436b-9df8-703ffd75bfcb",
"status": "Settled"
}
My ask is the next, of where exit out the "patient", "actual Fee", "discount", "discounted", "paymentID" and "status" variables???
the true i dont remember declare this variables in the tutorial, so this variables come out of the JAR back-end service?? is very important that i can comprend the funcionality this type orchestation in WSO2, i only have cause knoledge of this in M.U.L.E. interfaced with Spring TS and is my first once using WSO2, i going to very thanks if anyone oriente to me, i am scattered in WSO2.
答案1
得分: 0
当您调用 http://localhost:8290/healthcare/categories/surgery/reserve
时,它将进入资源块 /categories/{category}/reserve
,该资源块会检查医院名称。在您的有效负载中,医院名称是 "hospital": "grand oak community hospital"
,它将被路由到 Grand Oak 终端 <endpoint key="GrandOakEP"/>
。然后,从该终端获取的任何响应都将被发送回给调用方。因此,您看到的响应来自后端 Jar。
英文:
When you call http://localhost:8290/healthcare/categories/surgery/reserve
it goes to the resource block /categories/{category}/reserve
which checks the hospital name. In your Payload the hospital name is "hospital": "grand oak community hospital"
which will be routed to the Grand Oak endpoint <endpoint key="GrandOakEP"/>
. Then what ever the response you get from this endpoint will be sent back to the caller. So the response you are seeing in coming from the Backend Jar.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论