标注正在呼叫不同的端点

问题描述 投票:0回答:1

您好,我是wso2的新手,我有2个api,我想使用第一个调用第二个,但是标注介体使用的网址与我设置的网址不同,导致错误HTTPSender无法sendVia获取网址[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端点在邮递员上呼叫时有效

wso2 wso2esb
1个回答
0
投票

它似乎表明您的serviceURL由api url映射后缀,请尝试在标注之前添加它(必须在发送调解器的情况下使用,不确定是否要标注,但是看起来像是相同的行为:]

<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
© www.soinside.com 2019 - 2024. All rights reserved.