gpt4 book ai didi

java - SOAPMessage GZIP 实现

转载 作者:行者123 更新时间:2023-12-02 08:37:15 26 4
gpt4 key购买 nike

我想为 SOAPMessage 实现 GZIP。下面是正常的 SOAP 客户端调用代码 -

    // Create a new SOAP message from the factory and set the SOAPAction header.

MessageFactoryImpl factory = new MessageFactoryImpl();
SOAPMessage soapMsg = factory.createMessage();

// Set the SOAP envelope contents to our ebXML DOM.

SOAPPart part = soapMsg.getSOAPPart();
part.setContent(new DOMSource(docSoapReq));

// Create a SOAPConnection to send the SOAP request on.

SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
SOAPConnection con = conFactory.createConnection();

// Point to the service we want to call, and then call it.
// Store the response in the "reply" object.

URLEndpoint endPoint = new URLEndpoint(serviceURL);


SOAPMessage reply = con.call(soapMsg, endPoint);
con.close();

return (reply);

我如何在上述代码中的 SOAPMessage 中实现 GZIP。我为此进行了谷歌搜索,但没有找到任何有用的东西。

请告知我如何实现 SOAPMessage。

最佳答案

MimeHeaders headers = soapMsg.getMimeHeaders();
heders.addHeader("Accept-Encoding", "gzip,deflate");

在 jdk 1.6 中给出不可读的响应

关于java - SOAPMessage GZIP 实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1243298/

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