标注正在调用不同的端点

Callout is calling a diferent endpoint

嗨,我是 wso2 的新手,我有 2 个 api,我想用第一个调用第二个,但是标注调解器使用的 url 是不同的从我设置的那个,导致错误 HTTPSender Unable to sendViaGet to url[http://192.168.20.1:8280/loginAPI/login/Nurse]

代码如下

欢迎任何帮助

<api context="/Staff" name="StaffAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" url-mapping="/Nurse">
    <inSequence>
        <log level="full"/>
        <callout description="" initAxis2ClientOptions="false" serviceURL="http://192.168.20.1:8280/loginAPI/login">
            <source type="envelope"/>
            <target key="response"/>
        </callout>
        <log level="custom">
            <property expression="get-property('response')" name="response"/>
        </log>
        <send>
            <endpoint key="NurseEP"/>
        </send>
    </inSequence>
    <outSequence>
        <send/>
    </outSequence>
    <faultSequence/>
</resource>

<api context="/loginAPI" name="LoginAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/login">
    <inSequence>
        <payloadFactory media-type="json">
            <format>{&#xd;
                "userName": "xxx",&#xd;
                "password": "xxx",&#xd;
                "rememberMe": true,&#xd;
                "fireBaseToken": "string"&#xd;
            }</format>
            <args/>
        </payloadFactory>
        <cache collector="false" hashGenerator="org.wso2.carbon.mediator.cache.digest.DOMHASHGenerator" id="Token" maxMessageSize="2000" scope="per-host" timeout="5000">
            <onCacheHit/>
            <implementation maxSize="1000" type="memory"/>
        </cache>
        <send>
            <endpoint key="LoginEP"/>
        </send>
    </inSequence>
    <outSequence>
        <cache collector="true" scope="per-host"/>
        <send/>
    </outSequence>
    <faultSequence/>
</resource>

邮递员调用时的http://192.168.20.1:8280/loginAPI/login端点有效

你的 serviceURL 以你的 api url-映射为后缀,尝试在 callout 之前添加它(它必须在发送调解器的情况下使用,不确定 callout 但它看起来像相同的行为):

<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>