WSO2 ESB 6.1.1 - ни один CApp не отвечает - PullRequest
0 голосов
/ 18 мая 2018

Я новичок в этом приложении, но я пробовал некоторые учебники, и все они не получили ответа, ничего не происходит.Я просто отправляю запрос и ничего.Я развернул и все выглядит как объяснено в руководствах, но когда я пытаюсь выполнить, в моем просмотре или скручивании ничего не появляется.

Вот пример:

<?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="RequestLog"/>
            <send/>
        </inSequence>
        <outSequence>
            <log description="ResponseLog"/>
            <send/>
        </outSequence>
        <faultSequence>
            <log description="ErrorLog"/>
        </faultSequence>
    </resource>
    <resource methods="POST" uri-template=" /categories/{category}/reserve">
        <inSequence>
            <property description="GetHospital" expression="json-eval($.hospital)" name="Hospital" scope="default" type="STRING"/>
            <switch source="get-property('Hospital')">
                <case regex="grand oak community hospital">
                    <log description="GrandOakLog" level="custom">
                        <property expression="fn:concat('Routing to ', get-property('Hospital'))" name="message"/>
                    </log>
                    <send/>
                </case>
                <case regex="clemency medical center">
                    <log description="ClemencyLog" level="custom">
                        <property expression="fn:concat('Routing to ', get-property('Hospital'))" name="message"/>
                    </log>
                    <send/>
                </case>
                <case regex="pine valley community hospital">
                    <log description="PineValleyLog" level="custom">
                        <property expression="fn:concat('Routing to ', get-property('Hospital'))" name="message"/>
                    </log>
                    <send/>
                </case>
                <default>
                    <log description="ErrorLog" level="custom">
                        <property expression="fn:concat('Invalid hospital - ', get-property('Hospital'))" name="message"/>
                    </log>
                    <respond description="RespondError"/>
                </default>
            </switch>
        </inSequence>
        <outSequence/>
        <faultSequence>
            <log description="ErrorLog"/>
        </faultSequence>
    </resource>
</api>


<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="ClemencyEP" xmlns="http://ws.apache.org/ns/synapse">
    <http method="post" uri-template="http://wso2training-restsamples.wso2apps.com/clemency/categories/{uri.var.category}/reserve"/>
</endpoint>

<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="GrandOakEP" xmlns="http://ws.apache.org/ns/synapse">
    <http method="post" uri-template="http://wso2training-restsamples.wso2apps.com/grandoaks/categories/{uri.var.category}/reserve"/>
</endpoint>

<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="PineValleyEP" xmlns="http://ws.apache.org/ns/synapse">
    <http method="post" uri-template="http://wso2training-restsamples.wso2apps.com/pinevalley/categories/{uri.var.category}/reserve"/>
</endpoint>

И вот запросчтобы приложение работало:

{
  "patient": {
    "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"
}

1 Ответ

0 голосов
/ 07 июня 2018

У вас должен быть вызов конечной точки в посреднике отправки

 <case regex="grand oak community hospital">
    <log description="GrandOakLog" level="custom">
        <property expression="fn:concat('Routing to ', get-property('Hospital'))" name="message"/>
    </log>
    <send>
        <endpoint name="GrandOakEP" xmlns="http://ws.apache.org/ns/synapse">
            <http method="post" uri-template="http://wso2training-restsamples.wso2apps.com/grandoaks/categories/{uri.var.category}/reserve"/>
        </endpoint>
    </send>
 </case>

А также в outSequence должен быть посредник <send/>

...