Weblogic: Exceeded stated content-length
2012-03-29 18:27
429 查看
URL url = new URL("http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl"); URLConnection conn = url.openConnection(); conn.setUseCaches(false); conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestProperty("Content-Length", Integer.toString(soap.length())); conn.setRequestProperty("Content-Type", "text/xml; charset=utf-8"); conn.setRequestProperty("SOAPAction", http://WebXml.com.cn/getWeatherbyCityName);
在tomcat下好使,但是在WebLogic下就挂了,报错
java.net.ProtocolException: Exceeding stated content length of 358
怎么会超长呢?
原因:
content-length这个是所传报文的byte类型的长度,而并非string字符串的长度,tomcat的编码格式iso-8859-1 ,而weblogic是GBK(或UTF-8)
这样就导致了超长。
解决办法:
conn.setRequestProperty("Content-Length", String.valueOf(soap.getBytes().length))就OK了!
转自:http://hite.iteye.com/blog/681903
相关文章推荐
- 关于weblogic下java.net.ProtocolException: Didn't meet stated Content-Length, wrote: 异常
- weblogic 11g java.net.ProtocolException: Exceeded stated content-length of: '13824' bytes
- 关于weblogic下java.net.ProtocolException: Didn't meet stated Content-Length, wrote:
- 关于weblogic下Did not meet stated content length of OutputStream异常
- 解决在weblogic上报java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '146592' bytes instead of stated: '462285' by
- The maximum string content length quota (8192) has been exceeded while reading XML data
- WCF:The maximum string content length quota (8192) has been exceeded while reading XML data
- The maximum string content length quota (8192) has been exceeded while reading XML data
- java.net.ProtocolException: Exceeded stated content-length of: '13824' bytes 用jspSmartUpload.jar下载 出错
- 调用WebServiceWebService提示The maximum string content length quota (8192) has been exceeded while reading XML data的解决办法
- didn't meet stated Content-length,wrote:'133' bytes instead of stated '204' bytes
- WCF常见异常-The maximum string content length quota (8192) has been exceeded while reading XML data
- The maximum string content length quota (8192) has been exceeded while reading XML data
- 解决weblogic下报java.net.ProtocolException: Exceeded stated content-length of异常问题
- java.net.ProtocolException: Exceeded stated content-length of: '6144' bytes
- Maximum request length exceeded
- HttpURLConnection getContentLength();返回时-1或者是0
- Tomcat 中响应头信息(Http Response Header) Content-Length 和 Transfer-Encoding 之种种
- HTTP协议中Content-Length的详细解读。
- getContentLength()为-1 解决方法