我有一些来自请求的内容,该请求已保存到.txt文件。
POST /domibus/services/...
Host: domibusbackend
Connection: close
Content-Length: 16189
Content-Type: multipart/related; type="application/soap+xml"; boundary="uuid:6b5b42a6-ea2f-4830-84c3-c799f38ca32a"; start="<[email protected]>"; start-info="application/soap+xml"
Accept: */*
User-Agent: Apache-CXF/3.3.2
Cache-Control: no-cache
Pragma: no-cache
.........
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>
CompressionType: application/gzip
MimeType: application/xml
†’^tÜ:–jq®Z{€Üş˝`cWłÓx˘ěxĐWé"v«8-ňBStÂá›Ë+•jnCćcv‰v2—ťř‘÷ż÷ ĺůéűI˝sJá@Vzľ¸…“ߟ¤Ž2]§yÁbů,m ĺgٱťŠ¸áĐĽ<í.ÖÚeGü®î…Č>
-b¶öG BD,[âŤţ*^lJĘ@DLŃ%Ó:°Ě¸ÉÇVťäś(ăÉÁSy¨±ă“˙řµÁ¨žńˇęÁŽ‚GyvSĄ Ąeě$EI‡*0ĎEĽ•(Ú/{ôđ:d?ćŢ6AgŽ¦ ?ý+𣔣bÁË:˛×í„EQT·
ł/0Ž!ÂŚ6öpqÚ[Q˛ä–ů'0]
ŢfĎgÓŤß7ü–ඤşÔř»?É€“}%ů†Z/€ęŃ·b÷ĂR
żŇ’!|…q· FÉ2ľÎöDÎ>ÖËY)hşk’
łÍĚäŕ„ę+
ă6ţwÇäŘöpŻŞŁ¬tµŢp&ŁK?„8îIč™U\Ä_j)Q“˝QI·čOŽ|ż/Żl±MÁŔµ¤·c{ëŇś¸űXďß%yň¤¨CŇ1ÂĎVÜÝÁwăł[Ť
ťÔ‹Ń(µ[
p]r1Żq{0Ů7ęŐGGżX"˘ćŇÇgj*TRĽĺ*Ă@@ŐÖKąĐ•ľe7ąWöVĺ:çĂŢnHöT}ł•ť!dĂô¬ZTz'ÝS.¤öX×čÜť9Ü°™ô-Ue#xÚ–LL‡
í
‹Uĺ×Tśü«$tĚ
有人可以告诉我如何将这些数据转换为人类可读的数据吗?它在标头中说应该是二进制的,但事实并非如此,二进制数据看起来有所不同。如果有人可以帮助我,我将不胜感激。谢谢!
此建议压缩:CompressionType: application/gzip
我假设您正在使用Servlet-API
public void doPost(HttpServletRequest request, HttpServletResponse response) {
InflaterInputStream is = InflaterInputStream(request.getInputStream());
String readableString = extract(is);
// do the processing
}
然后将压缩的二进制数据转换为可读的字符串
private String extract(InputStream is) throws IOException {
StringBuffer sb = new StringBuffer();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
String inputLine = "";
while ((inputLine = in.readLine()) != null) {
sb.append(inputLine);
}
return sb.toString();
}