微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

WSO2 EI-如何在 WSO2 中通过 URL发布附加和接收“表单数据”附件?

如何解决WSO2 EI-如何在 WSO2 中通过 URL发布附加和接收“表单数据”附件?

我的 WSO2 代码应通过 PostMan 请求接收文件附件。 然后我必须形成一个 HTTP 请求以连接到 Zoho Portal,我必须在其中将文件附件作为表单数据类型作为 Post 方法发送。

作为附件发送的文件将发送到Zoho task creation endpoint,以便使用文档创建任务。

注意:当我尝试通过调用 Zoho Task APi 直接与邮递员发送附件时,它成功地创建了一个带有附件的任务,但不能用 WSO2 代码做同样的事情。

我的 WSO2 代码

<resource methods="POST" uri-template="/createTask?PortalId={portalid}&amp;ProjectId={projectid}">
    <inSequence>
        <log level="custom">
            <property name="Welcome Logger" value="=== Task Creation API Started ==="/>
            <property expression="get-property('uri.var.portalid')" name="uri.var.portalId"/>
            <property expression="get-property('uri.var.projectid')" name="uri.var.ProjectId"/>
        </log>
        <property description="Configuration" expression="get-property('ZohoApp-Config')" name="ZohoAppConfig" scope="axis2" type="OM"/>
        <property expression="get-property('registry','gov:/ZohoConfig/ZohoAppConfigFile.txt')" name="accesstoken" scope="default" type="STRING"/>
        <property description="RefreshToken" expression="$axis2:ZohoAppConfig//*[local-name()='refreshToken']/text()" name="refreshToken" scope="default" type="STRING"/>
        <property description="BaseUri" expression="$axis2:ZohoAppConfig//*[local-name()='PortalDetails']/text()" name="uri.var.BaseURI" scope="default" type="STRING"/>
        <property expression="json-eval($.task_name)" name="uri.var.task_name" scope="default" type="STRING"/>
        <property description="URI1" name="uri.var.Projects" scope="default" type="STRING" value="projects"/>
        <property description="URI2" name="uri.var.Tasks" scope="default" type="STRING" value="tasks"/>
        
        <filter regex="false" source="get-property('uri.var.task_name')=''">
            <then>
                <property expression="fn:concat('name=',get-property('uri.var.task_name'),'&amp;person_responsible=',get-property('uri.var.owner_id'),'&amp;description=',get-property('uri.var.description'),'&amp;priority=',get-property('uri.var.priority'))" name="uri.var.taskdetails" scope="default" type="STRING"/>
                <log level="custom">
                    <property expression="fn:concat('name=',get-property('uri.var.priority'))" name="uri.var.taskdetails"/>
                </log>
                <header expression="fn:concat('Bearer ',get-property('accesstoken'))" name="Authorization" scope="transport"/>
                <call>
                    <endpoint>
                        <http method="post" uri-template="{uri.var.BaseURI}/{uri.var.portalid}/{uri.var.Projects}/{uri.var.projectid}/{uri.var.Tasks}/?name={uri.var.task_name}&amp;person_responsible={uri.var.owner_id}&amp;description={uri.var.description}&amp;priority={uri.var.priority}&amp;">
                            <suspendOnFailure>
                                <initialDuration>-1</initialDuration>
                                <progressionFactor>1</progressionFactor>
                            </suspendOnFailure>
                            <markForSuspension>
                                <retriesBeforeSuspension>0</retriesBeforeSuspension>
                            </markForSuspension>
                        </http>
                    </endpoint>
                </call>
                <property description="ResponseMessage" expression="json-eval($.error.message)" name="ResponseMessage" scope="default" type="STRING"/>
                <log level="custom">
                    <property expression="json-eval($)" name="==== Task Creation Response ===="/>
                    <property expression="get-property('axis2','HTTP_SC')" name="==== HTTP Status Code ===="/>
                </log>
                
                <log>
                    <property name="Process Status" value="=== Completed ==="/>
                </log>
                <respond/>
            </then>
            <else>
                <log>
                    <property name="Response" value="=== Task Name Missing ==="/>
                </log>
                <respond/>
            </else>
        </filter>
        <respond/>
    </inSequence>
    <outSequence/>
    <faultSequence/>
</resource>

谁能告诉我如何在 WSO2 EI 6.1.1 的 API 中实现这一点

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。