问题描述
我的 WSO2 代码应通过 PostMan 请求接收文件附件。 然后我必须形成一个 HTTP 请求以连接到 Zoho Portal,我必须在其中将文件附件作为表单数据类型作为 Post 方法发送。
作为附件发送的文件将发送到Zoho task creation endpoint,以便使用文档创建任务。
注意:当我尝试通过调用 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.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 中实现这一点
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)