【问题标题】:WSO2 EI 6.1.1 post request body not sendWSO2 EI 6.1.1 发布请求正文未发送
【发布时间】:2018-06-19 22:32:54
【问题描述】:

我对 wso2 EI 6.1.1 有疑问。我尝试使用调用调解器将数据发布到端点,其中数据是通过我创建的类创建的。

问题是身体似乎总是空的。类的结果对象不作为正文发送。

<resource methods="POST" url-mapping="/itineraries">
        <inSequence>
            <property description="baseUrl" expression="get-property('boBaseUrl')" name="uri.var.boBaseUrl" scope="default" type="STRING"/>
            <property description="InsiteoClientId" expression="get-property('InsiteoClientID')" name="clientID" scope="default" type="STRING"/>
            <property description="appVersion" expression="$trp:X-app-version" name="appVersion" scope="default" type="STRING"/>
            <property description="buildingId" expression="$trp:X-current-building-id" name="uri.var.buildingId" scope="default" type="STRING"/>
            <property description="wayPoints" expression="json-eval($.)" name="wayPoints" scope="default" type="STRING"/>
            <call>
                <endpoint>
                    <http method="get" uri-template="{uri.var.boBaseUrl}/api/v1/buildings/{uri.var.buildingId}"/>
                </endpoint>
            </call>
            <property description="floors" expression="json-eval($.floors)" name="floors" scope="default" type="STRING"/>
            <property description="InsiteoSiteId" expression="json-eval($.information.insiteoIDSite)" name="uri.var.insiteoSiteId" scope="default" type="STRING"/>
            <class description="ItineraryClass" name="com.capgemini.smartWorkPlace.Itinerary"/>
            <log level="full"/>
            <header expression="get-property('InsiteoApiKey')" name="Authorization" scope="transport"/>
            <call>
                <endpoint>
                    <http method="post" uri-template="http://services.test.insiteo.com/APIV3/{uri.var.insiteoSiteId}/iti/process"/>
                </endpoint>
            </call>
            <log level="full"/>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>

请求状态码返回 500,就好像从未发送过任何正文一样。

非常感谢您的帮助。

【问题讨论】:

    标签: wso2 wso2esb wso2ei


    【解决方案1】:

    在您的类调解器中,检查您是否将创建的有效负载设置为上下文主体。如果是json,

    JsonUtil.getNewJsonPayload(axis2MessageContext, jsonPayload.toString(), true, true);
    

    【讨论】:

    • 你好,是的,我确实这样做了当我记录类的结果有效负载时,我得到了一个合适的 json,我用邮递员尝试了它,它可以工作。问题是这个有效载荷没有转移到调用中
    • 发现是第一次调用有问题,好像ei没有修改body
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-16
    • 1970-01-01
    • 2017-08-31
    • 2021-03-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多