您好,我是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>{
"userName": "xxx",
"password": "xxx",
"rememberMe": true,
"fireBaseToken": "string"
}</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映射后缀,请尝试在标注之前添加它(必须在发送调解器的情况下使用,不确定是否要标注,但是看起来像是相同的行为:]
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>