gpt4 book ai didi

android - Worklight - MTOM 附件图像文件

转载 作者:行者123 更新时间:2023-11-29 12:15:07 25 4
gpt4 key购买 nike

作为我的 worklight 项目的一部分,我们正在调用一个 Web 服务,该服务将图像文件作为 MTOM 附件发送。有没有办法解析图像内容并转换为 JSON 对象?下面是我配置服务调用的适配器中的一段代码:

 var input = {      
method : 'post',
returnedContentType : 'plain',
path: '/contentaccess-ws/ContentAccessDocument_1',
body : {
content: retrieveDocumentRequest.toString(),
contentType : 'application/soap+xml; charset=utf-8'
}
};

下面是响应:

--MIMEBoundary_89c65bb62e242e7ee812d596799431326111505dc1baf518
Content-Type: application/xop+xml; charset=utf-8;
type="application/soap+xml"
Content-Transfer-Encoding: binary
Content-ID: <0.99c65bb62e242e7ee812d596799431326111505dc1baf518@apache.org>

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body><c:retrieveDocumentResponse xmlns:a="http://docs.oasis.open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:b="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:c="http://nationwide.com/schemas/Communication/iaa7_1/Content/DocumentManagement_1">
<c:Document><c:Attachments type="Content">
<c:Attachment><c:Name>Photo.jpg</c:Name>
<c:MimeType>image/jpeg</c:MimeType><c:Size>147623</c:Size>
<c:DataContent><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:a9c65bb62e242e7ee812d596799431326111505dc1baf518@apache.org"/></c:DataContent>
</c:Attachment></c:Attachments>
<c:Properties><c:Property><c:Name>Id</c:Name><c:Value>{D0C04F-0000-C511-983F-4BD2AB945534}</c:Value></c:Property><c:Property><c:Name>F_PAGES</c:Name><c:Value></c:Value></c:Property></c:Properties>
</c:Document><c:Status>Successful</c:Status>
</c:retrieveDocumentResponse></soapenv:Body></soapenv:Envelope>
--MIMEBoundary_89c65bb62e242e7ee812d596799431326111505dc1baf518
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <a9c65bb62e242e7ee812d596799431326111505dc1baf518@apache.org>

????_JFIF___HH??(ExifMM*__?i___??8Photoshop 3.08BIM__8BIM_%_?_?ُ?_? ???B~
___?_?__"______??_________________
_???_____________}_______!1A__Qa_"q_2???_#B??_R??$3br?
___%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz?????????????????????????????? ?????????????????????????????????????????????____________________
_???______________w______!1__AQ_aq_"2?__B???? #3R?_br?
_$4?%? ____&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz????????????????????????????????? ?????????????????????????????????????????C______ __ - -=---- =M=====M]MMMMMM]]]]]]]]pppppp?????????????????C____%#%@##@? hUh????????????????????????????????????????????????????_^??

我尝试将“returnedContentType”作为“JSON”但没有用(服务向我抛出错误)。

感谢任何指点!

最佳答案

适配器不会为您执行此操作。

您需要做的是从适配器获取响应,并使用能够将图像附件解码为真实图像的框架。

通常不使用 MOTM。相反,您将图像用 base64 编码为字符串,然后将字符串解码回图像。

关于android - Worklight - MTOM 附件图像文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32212678/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com