Hi All,
I am sorry to post this problem here if it not relevant, but I have investigated so much but couldn't come up to a solution.
I have developed a Web service using JAX-WS 2.1 and successfully deployed on Tomcat 6.0.14. My Web Service accepts and sends large data. So i have tried to use data compression on Tomcat.
*
I have successfully performed sending compressed HTTP Response from tomcat but not able to configure it for accepting compressed HTTP Requests.* If you need more details about my problem read further.
I have successfully configured my tomcat server.xml like below:
<!-- HTTP Connector with Data Compression Enabled -->
<Connector
port="8080"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
compression="on"
compressionMinSize="20"
compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css"
/>
Tomcat will send compressed responses to clients when ever it is willing to accept compressed data otherwise server will send plain responses.
Now on words when ever server will get HTTP Request with *"Accept-Encoding: gzip"* set it will send compressed response to that HTTP Request and plain response otherwise. All modern web browsers accepts compressed data.
This is working great.
-----
*My Problem is I want tomcat to accept and understand compressed HTTP Requests also*, for that I have compressed my request with java.util.zip.GZIPOutputStream and set HTTP Request Property like below:
"Content-Encoding: gzip"
"Accept-Encoding: gzip"
But server returns error code 500( Internal Server Error). The server log shows error like:
com.sun.xml.ws.streaming.XMLReaderException: Unable to create StAX reader or writer
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory$Zephyr.doCreate(XMLStreamReaderFactory.java:305)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:143)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:147)
at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:133)
at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:294)
...
Caused by: javax.xml.stream.XMLStreamException: java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.xml.stream.XMLReaderImpl.setInputSource(XMLReaderImpl.java:197)
at com.sun.xml.stream.XMLReaderImpl.<init>(XMLReaderImpl.java:180)
...
Caused by: java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.xml.stream.xerces.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:724)
at com.sun.xml.stream.xerces.impl.io.UTF8Reader.read(UTF8Reader.java:593)
Please guide me through...
- Tejas Purohit