[英]Saving a file returned by web-service in java
I have to make a call to a web-service for which the response is as per following 我必须拨打一个响应如下的Web服务
<ns2:wsresponse>
<ns2:length>10582</ns2:length>
<ns2:filecontent>H4sIAAAAAAAAALVZa3OjSLL9fB...
(Snip)
</ns2:filecontent>
<ns2:contentType>application/gzip</ns2:contentType>
</ns2:wsresponse>
The web-service is actually returning a file which is encoded using mime-type application/gzip (as in ns2:contentType). 该Web服务实际上返回的文件是使用mime类型的application / gzip编码的(如ns2:contentType)。 I am not sure how to save the file on disk on the client side in java? 我不确定如何在Java客户端的磁盘上保存文件?
The <ns2:filecontent>
tag appears to hold a BASE64 encoded string which probably is the content of the file. <ns2:filecontent>
标记似乎包含BASE64编码的字符串,该字符串可能是文件的内容。
Basically take that BASE64 encoded string decode it and the resulting byte[] can be used to store the data on disk. 基本上采用BASE64编码的字符串对其进行解码,然后可以使用所得的byte []将数据存储在磁盘上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.