【问题标题】:wso2 - http PDF response - save file on WSO2 server instead of downloadwso2 - http PDF 响应 - 在 WSO2 服务器上保存文件而不是下载
【发布时间】:2020-11-27 12:53:37
【问题描述】:

我想将响应中的 PDF 文件直接保存在 WSO2 服务器上。当我在浏览器中打开 API URL 时,Chrome 会自动在我的本地计算机上下载文件。如何将这个文件直接保存在 WSO2 服务器上?

<api xmlns="http://ws.apache.org/ns/synapse" name="test" context="/test">
   <resource methods="GET" uri-template="/test*">
      <inSequence>
         <payloadFactory media-type="xml">
            <format>
               <root>
                  <mtfId>150</mtfId>
                  <orderSno>50339375</orderSno>
               </root>
            </format>
            <args/>
         </payloadFactory>
         <property name="messageType" value="application/x-www-form-urlencoded" scope="axis2" type="STRING"/>
         <property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
         <call>
            <endpoint>
               <http method="POST" uri-template="https://www.proceedo.net/suppliercenter/common/orderexport.do"/>
            </endpoint>
         </call>
         <respond/>
      </inSequence>
      <faultSequence/>
   </resource>
</api>

【问题讨论】:

    标签: wso2 wso2esb wso2is esb


    【解决方案1】:

    您可以使用文件连接器在 ESB 服务器中创建文件。关于如何设置文件连接器请参考[1],您可以使用文件连接器创建操作[2]来实现您的要求。

    <fileconnector.create>
        <filePath>{$ctx:filePath}</filePath>
        <inputContent>{$ctx:inputContent}</inputContent>
        <encoding>{$ctx:encoding}</encoding>
        <setTimeout>{$ctx:setTimeout}</setTimeout>
        <setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
        <setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
        <setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
        <setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
    </fileconnector.create>
    

    [1]-https://docs.wso2.com/display/ESBCONNECTORS/File+Connector [2]-https://docs.wso2.com/display/ESBCONNECTORS/Working+with+the+File+Connector#WorkingwiththeFileConnector-create

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-20
      • 2015-02-27
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2022-11-17
      • 1970-01-01
      相关资源
      最近更新 更多