Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从JBOSS 4.2.3调用JSON webservice响应压缩时出现问题_Java_Jquery_Json_Jboss_Webservice Client - Fatal编程技术网

Java 从JBOSS 4.2.3调用JSON webservice响应压缩时出现问题

Java 从JBOSS 4.2.3调用JSON webservice响应压缩时出现问题,java,jquery,json,jboss,webservice-client,Java,Jquery,Json,Jboss,Webservice Client,在JBOSS Appserver中托管Axis2 JSON web服务,并在连接器中配置响应压缩(在server.xml文件中)。通过Java客户端测试该服务,并收到压缩(GZIP)模式的响应(通过eclipse中的TCP/IP监视器进行监控) 现在的问题是,当我从jQuery客户机调用相同的web服务时,响应不是处于压缩模式,而是接收到正常响应,而不是压缩(GZIP)模式 下面是JBOSS中的配置 <Connector port="8080" address="${jboss.bind.

在JBOSS Appserver中托管Axis2 JSON web服务,并在连接器中配置响应压缩(在server.xml文件中)。通过Java客户端测试该服务,并收到压缩(GZIP)模式的响应(通过eclipse中的TCP/IP监视器进行监控)

现在的问题是,当我从jQuery客户机调用相同的web服务时,响应不是处于压缩模式,而是接收到正常响应,而不是压缩(GZIP)模式

下面是JBOSS中的配置

<Connector port="8080" address="${jboss.bind.address}"    
     maxThreads="250" maxHttpHeaderSize="8192"
     emptySessionPath="true" protocol="HTTP/1.1"
     enableLookups="false" redirectPort="8443" acceptCount="100"
     connectionTimeout="20000" disableUploadTimeout="true" 
     compression="on"  compressionMinSize="2048" 
     noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml,text/css,text/javascript,application/x-javascript,application/javascript,application/json;charset=UTF-8,image/svg+xml,text/json,gzip"/>
请你帮我解决这个问题


谢谢。

最后我从下面的帖子中得到了解决方案

解决方案:

我刚刚在浏览器中禁用了internet代理详细信息。触发了服务,现在我可以在fiddler中看到压缩响应

谢谢

<title>Calling Web Service from jQuery</title>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="json2.js"></script>
<script type="text/javascript">
 if (!window.console) console = {log: function() {}};
    $(document).ready(function () {
        jQuery.support.cors = true;
        $("#btnCallWebService").click(function (event) {
            var start = new Date().getTime();                
            var wsUrl = "http://10.191.54.97:8080/axis2/services/TestCompression?wsdl";             
            var soapRequest ="<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Body><ns1:Compression xmlns:ns1=\"http://www.example.org/TestCompression/\"><CompressionReq>test</CompressionReq></ns1:Compression></soapenv:Body></soapenv:Envelope>"; 
            $.ajax({
               type: "POST",
                url: wsUrl,
                contentType: "text/xml",                    
                dataType: "json",
                headers: { "Accept-Encoding" : "gzip" },
                data: soapRequest,
                success: processSuccess,
                error: processError
            });

        });
    });     
    function processSuccess (data) {        
      console.log(data);        
      var strdata = JSON.stringify(data);       
      $('#response').html(strdata);     
    }
    function processError(data, status, req) {
       alert('iam failure')
       alert(req.responseText + " " + status);
    }
</script>
HTTP/1.1 200 OK
Via: 1.1 RSI-CHE-TMG01
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
Date: Wed, 09 Apr 2014 08:42:36 GMT
Content-Type: application/json;charset=UTF-8
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)/JBossWeb-2.0