首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Callout正在调用其他终结点

Callout正在调用其他终结点
EN

Stack Overflow用户
提问于 2019-10-29 00:04:09
回答 1查看 35关注 0票数 0

嗨,我是wso2新手,我有两个api,我想用第一个调用第二个api,但是调出中介使用的url与我设置的不同,导致错误HTTPSender Unable to sendViaGet to url[http://192.168.20.1:8280/loginAPI/login/Nurse]

代码如下

欢迎任何帮助。

代码语言:javascript
复制
<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>

代码语言:javascript
复制
<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>

在postman上调用时,http://192.168.20.1:8280/loginAPI/login终结点是有效的

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-29 00:29:42

它看起来你的serviceURL被你的api url映射作为后缀,试着在callout之前添加(它必须在发送中介的情况下使用,对于callout不确定,但它看起来是相同的行为):

代码语言:javascript
复制
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58594351

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档