2017-01-25 33 views
0

我遵循了本教程中給出的步驟。如何通過WSO2 ESB發出API請求

https://docs.wso2.com/display/ESB500/Sending+a+Simple+Message

正確地做了一切,但是當我試圖(通過8280端口)來調用通過ESB的API,會顯示錯誤代碼202。儘管我沒有指定任何故障順序。

我已經嘗試了正確的每一步,並確保API的終點工作正常。

+0

您可以啓用日誌線檢查會發生什麼你的要求。 http://mytecheye.blogspot.com/2013/09/wso2-esb-all-about-wire-logs.html – Pubci

+0

如果你想讓別人來幫助你,請正確解釋你做了什麼。 – Bee

回答

1

我也沒的例子......在這裏你有我的配置: --the端點定義(右鍵單擊在示例 - > endpoint->創建新的端點) -

<endpoint name="QueryDoctorEP" xmlns="http://ws.apache.org/ns/synapse"> 
    <http method="get" uri-template="http://wso2training-restsamples.wso2apps.com/healthcare/{uri.var.category}"/> 
</endpoint> 

- 我的API定義(右鍵單擊在示例 - > API休息 - >創建新的API休息)

<?xml version="1.0" encoding="UTF-8"?> 
<api context="/healthcare" name="HealthcareAPI" xmlns="http://ws.apache.org/ns/synapse"> 
    <resource methods="GET" uri-template="/querydoctor/{category}"> 
     <inSequence> 
      <log description="Request Log" level="custom"> 
       <property name="message" value="Welcome to HealthcareService"/> 
      </log> 
      <send> 
       <endpoint key="QueryDoctorEP"/> 
      </send> 
     </inSequence> 
     <outSequence> 
      <send/> 
     </outSequence> 
     <faultSequence/> 
    </resource> 
</api> 

等待服務器部署的配置... 請求:(我的偏移量爲3)

curl -v http://localhost:8283/healthcare/querydoctor/surgery 

在這裏你有捲曲響應

About to connect() to localhost port 8283 (#0) 
* Trying 127.0.0.1... 
* connected 
* Connected to localhost (127.0.0.1) port 8283 (#0) 
> GET /healthcare/querydoctor/surgery HTTP/1.1 
> User-Agent: curl/7.25.0 (i386-pc-win32) libcurl/7.25.0 OpenSSL/0.9.8u zlib/1.2.6 libssh2/1.4.0 
> Host: localhost:8283 
> Accept: */* 
> 
< HTTP/1.1 200 OK 
< Content-Type: application/json 
< Date: Thu, 26 Jan 2017 16:00:51 GMT 
< Transfer-Encoding: chunked 
< 
[{"name":"thomas collins","hospital":"grand oak community hospital","category":"surgery","availability":"9.00 a.m - 11.00 a.m","fee":7000.0},{"name":"anne clement","hospital":"clemency 
medical center","category":"surgery","availability":"8.00 a.m - 10.00 a.m","fee":12000.0},{"name":"seth mears","hospital":"pine valley community hospital","category":"surgery","availa 
bility":"3.00 p.m - 5.00 p.m","fee":8000.0}]* Connection #0 to host localhost left intact 
* Closing connection #0