简体   繁体   中英

How to make an API request through the WSO2 ESB

I've followed the steps given in this tutorial.

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

Did everything correctly but when I am trying to invoke the api through the ESB ( through the 8280 port), error code 202 is displayed. Even though I haven't specified any fault sequence.

I've tried each step correctly and Also made sure that the end point of the api works correctly.

I also did the example... here you have my configuration: --the endpoint definition (right click over the example->endpoint->create new 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>

-- my api definition (right click over the example->API Rest->Create new API Rest)

<?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>

Wait until the server deploys the configuration... the request: (my offset is 3)

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

Here you have the curl response

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM