wso2gzipwso2-data-services-serverhttp-compression

WSO2 - Data Service - GZIP - Data compression - JSON


I have a DataService (behind a managed API) that have to receive a JSON gziped (as it is a large dataset).

Micro integrator: WSO2MI-4.2.0 API Manager : WSO2AM-4.2.0 Identity MGT: WSO2IS-6.0.0

But I receive this error message:

<faultstring>I/O  Exception occured while building the data service request</faultstring>


[2023-05-22 12:49:56,791] ERROR {org.apache.synapse.transport.passthru.ServerWorker} - Error processing POST request for : /services/dsfenicio_testing/insertarLogImportacion_test org.apache.axis2.AxisFault$
        at org.wso2.micro.integrator.core.handlers.IntegratorStatefulHandler.invoke(IntegratorStatefulHandler.java:129)
        at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
        at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:379)
        at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:438)
        at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:186)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.axis2.AxisFault: Error while building Passthrough stream
        at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:458)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:221)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:127)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:94)
        at org.wso2.micro.integrator.core.handlers.IntegratorStatefulHandler.invoke(IntegratorStatefulHandler.java:90)
        ... 11 more
Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
        at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
        at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:165)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:174)
        ... 14 more

Caused by: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)
        at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:625)
        at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:997)
        at com.ctc.wstx.sr.StreamScanner.getNext(StreamScanner.java:754)
        at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2000)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
        at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
        at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
        ... 19 more
Caused by: java.io.CharConversionException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)
        at com.ctc.wstx.io.UTF8Reader.reportInvalidInitial(UTF8Reader.java:303)
        at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:189)
        at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:87)
        at com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
        at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:991)
        ... 26 more

[2023-05-22 12:49:56,791]  WARN {org.apache.synapse.transport.passthru.util.RelayUtils} - Server encountered an error, the request message will be consumed and discarded, , CLIENT_ADDRESS = /192.168.134.81$

any help will be much appreciated

Thanks


Solution

  • Try adding the following to the deploymet.toml

    [[custom_message_builders]]
    class = "org.wso2.carbon.relay.BinaryRelayBuilder"
    content_type = "application/gzip"
    
    [[custom_message_formatters]]
    class = "org.wso2.carbon.relay.ExpandingMessageFormatter"
    content_type = "application/gzip"