后端编排服务在WSO2中

huangapple go评论55阅读模式
英文:

back-end orchestration service in WSO2

问题

我遵循了这个教程来稍微了解如何在WSO2中开发服务编排,但仍然有一些问题。

好的,在最后,在第5步中,指示如何测试用例以运行编排,步骤如下:

  1. 下载后端服务的JAR文件。
  2. 打开终端并导航到保存后端JAR服务的目录。
  3. 使用以下命令执行后端服务的JAR文件:
java -jar Hospital-Service-JDK11-2.0.0.jar

然后,使用"Postman API"进行测试,使用以下请求信息:

  1. 方法:"POST"
  2. 标头:"Content-Type=application/json"
  3. URL:http://localhost:8290/healthcare/categories/surgery/reserve
  4. 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 Response

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:

{ 
  &quot;name&quot;: &quot;John Doe&quot;, 
  &quot;dob&quot;: &quot;1940-03-19&quot;, 
  &quot;ssn&quot;: &quot;234-23-525&quot;, 
  &quot;address&quot;: &quot;California&quot;, 
  &quot;phone&quot;: &quot;8770586755&quot;, 
  &quot;email&quot;: &quot;johndoe@gmail.com&quot;, 
  &quot;doctor&quot;: &quot;thomas collins&quot;, 
  &quot;hospital&quot;: &quot;grand oak community hospital&quot;, 
  &quot;cardNo&quot;: &quot;7844481124110331&quot;, 
  &quot;appointment_date&quot;: &quot;2025-04-02&quot; 
} 

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:

{
    &quot;patient&quot;: &quot;John Do&quot;,
    &quot;actualFee&quot;: 7000.0,
    &quot;discount&quot;: 20,
    &quot;discounted&quot;: 5600.0,
    &quot;paymentID&quot;: &quot;5988f2a0-4d43-436b-9df8-703ffd75bfcb&quot;,
    &quot;status&quot;: &quot;Settled&quot;
}

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,该资源块会检查医院名称。在您的有效负载中,医院名称是 &quot;hospital&quot;: &quot;grand oak community hospital&quot;,它将被路由到 Grand Oak 终端 &lt;endpoint key=&quot;GrandOakEP&quot;/&gt;。然后,从该终端获取的任何响应都将被发送回给调用方。因此,您看到的响应来自后端 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 &quot;hospital&quot;: &quot;grand oak community hospital&quot; which will be routed to the Grand Oak endpoint &lt;endpoint key=&quot;GrandOakEP&quot;/&gt;. 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.

huangapple
  • 本文由 发表于 2023年6月5日 09:58:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76403131.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定