【问题标题】:IBM mobilefirst http Adapter unable to access pdf attachmentIBM mobilefirst http 适配器无法访问 pdf 附件
【发布时间】:2016-06-01 08:24:12
【问题描述】:

我正在尝试访问具有 PDFattachment 方法的 Web 服务,我实现了 HTTP 适配器并尝试访问附件,但我没有得到正确的附件文件,returnedContentType : 'plain' 和 contentType:'application/pdf' ,这里是soap UI和适配器响应的截图在这里输入图片描述

请建议如何通过工作灯适配器访问 pdf 附件

适配器代码:

function getInvoicePdfFile(prj_no, drft_No) {
    var request = 'soaprequest with parameters';
    var input = {
        method: 'POST',
        returnedContentType: 'plain',
        path: clintinvoicePath,
        headers: {
            SOAPAction: 'SoapAction end point',
            Authorization: authorisationPassword
        },
        body: {
            content: request.toString(),
            contentType: 'application/pdf',
        }
    };
    var result = WL.Server.invokeHttp(input);
    return result;
}

【问题讨论】:

  • 请分享您的适配器代码。
  • 嗨,Yoel,请在此处找到适配器代码
  • function getInvoicePdfFile(prj_no,drft_No) { var request = 'soaprequest with parameters'; var input = { method : 'POST', returnedContentType : 'plain', path : clintinvoicePath, headers: {SOAPAction: 'SoapAction end point', Authorization: authorisationPassword }, body : { content: request.toString(), contentType:'应用程序/pdf', } }; var 结果 = WL.Server.invokeHttp(输入);返回结果; }
  • @LingarajSajjan,你在这个问题上有什么进展吗?
  • 我们通过另一种方式完成,例如,将 pdf 数据从后端转换为 base64 数据,然后在前端使用 pdf.js 插件将 base64 转换为 pdf 页面,@IdanAdar

标签: cordova pdf ibm-mobilefirst soap-client worklight-adapters


【解决方案1】:

虽然不是最佳解决方案,但解决该问题的一种解决方案是将 PDF 数据编码为 base64,然后使用 pdf.js 将 base64 字符串解码回 PDF 文件并显示。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多