WSO2 ESB 6.1.1 - 任何CApp都没有响应

时间:2018-05-18 18:39:44

标签: wso2 esb

我是那个应用程序的noob,但我一直在尝试一些教程,所有这些都没有响应,没有任何反应。我只是发送请求而没有。我按照教程的说明部署了所有外观,但是当我尝试执行时,我的浏览或卷曲中没有任何内容。

这是一个例子:

<?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 :(得分:1)

您应该在send mediator

中进行端点调用
 <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/>介体