嗨,我是wso2新手,我有两个api,我想用第一个调用第二个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>{
"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>
在postman上调用时,http://192.168.20.1:8280/loginAPI/login终结点是有效的
发布于 2019-10-29 00:29:42
它看起来你的serviceURL被你的api url映射作为后缀,试着在callout之前添加(它必须在发送中介的情况下使用,对于callout不确定,但它看起来是相同的行为):
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>https://stackoverflow.com/questions/58594351
复制相似问题