0

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 を実装する方法を教えてください。

4

2 に答える 2

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

jdk1.6で読み取り不能な応答を返す

于 2012-10-23T07:07:23.903 に答える
0

次のようなことを試して、accept-encoding ヘッダーを設定します。

MimeHeaders headers = soapMsg.getMimeHeaders();
heders.addHeader("Accept-Encoding", "gzip,deflate");
于 2011-07-05T03:46:30.267 に答える