wso2 - WSO2 EI-如何在 WSO2 中通过 URL(发布)附加和接收“表单数据”(附件)?
问题描述
我的 WSO2 代码应该通过 PostMan 请求接收文件附件。然后我必须形成一个 HTTP 请求以连接到 Zoho Portal,在其中我必须将文件附件作为表单数据类型作为 Post 方法发送。
作为附件发送的文件将被发送到Zoho 任务创建端点,以便使用 Document 创建任务。
注意:当我尝试通过调用Zoho Task APi直接使用邮递员发送附件时,它成功地创建了一个带有附件的任务,但无法使用 WSO2 代码执行相同的操作。
我的 WSO2 代码:
<resource methods="POST" uri-template="/createTask?PortalId={portalid}&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'),'&person_responsible=',get-property('uri.var.owner_id'),'&description=',get-property('uri.var.description'),'&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.task_name'),'&person_responsible=',get-property('uri.var.owner_id'),'&description=',get-property('uri.var.description'),'&priority=',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}&person_responsible={uri.var.owner_id}&description={uri.var.description}&priority={uri.var.priority}&">
<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 中实现这一点
解决方案
推荐阅读
- rethinkdb - 有没有设置 rethinkdb 镜像的简单方法?
- solr - Solr 索引元组中的一些字段
- python - Keras 嵌入:索引 [15,138] = 12635 不在 [0, 12635)
- laravel - 如何在 laravel 中使用枚举来选择选项?
- postgresql - 如何在消息中打印 SQLSTATE
- javascript - 如何触发与 Vue 组件的另一个绑定
- c - 我将如何使用 rundll32.exe 来运行 pyd?
- scala - 导出 F[A] 的半群实例
- erlang - 错误的函数数量和警告:函数 hello_world/0 未使用
- python - x_train = x_train.astype('float64') ValueError: setting an array element with a sequence