-1
이상한 문제가 있으며 디버깅 방법을 모릅니다.길이가 1308 바이트를 초과하면 Http POST 요청이 응답을 얻지 못합니다.
WebService 서버에 POST SOAP 요청을해야합니다.
내 자바 코드는 다음 urlParameters가 1308 바이트보다 작거나 같으면
String urlParameters = "<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
..................
</soap:Body>
</soap:Envelope>";
URL url;
HttpURLConnection connection = null;
try {
//Create connection
url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
connection.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length));
connection.setRequestProperty("SOAPAction", "http://xxxxx/Foo");
connection.setUseCaches (false);
connection.setDoInput(true);
connection.setDoOutput(true);
//Send request
DataOutputStream wr = new DataOutputStream (connection.getOutputStream());
wr.writeBytes (urlParameters);
wr.flush();
wr.close();
//Get Response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuilder response = new StringBuilder();
while((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
}
rd.close();
지금 그것은 잘 작동하고 내가 응답을 얻을 수 있습니다. 그러나 길이가 1308 바이트를 초과하는 경우 (즉 문자열에 문자를 한 개 더 추가 한 경우) 작동하지 않습니다 (클라이언트 시스템에서 벗어나 서버에 도달하지 못하는 것 같습니다)
나는 soapUI 그것도 나에게 똑같은 문제를 준다. 우분투에서 실행 중입니다. 12.04
예 저는 CURL과 동일한 문제가 있습니다. 나는 1308 바이트보다 요청에 더 큰 할 때
* About to connect() to epermit port 8085 (#0)
* Trying 192.168.14.100... connected
> POST /xxx/xxx.asmx HTTP/1.1
> User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: xxx:8085
> Accept: */*
> Content-Type:text/xml; charset=utf-8
> SOAPAction:"xxxxx"
> Content-Length: 1304
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Cache-Control: private, max-age=0
< Content-Type: text/xml; charset=utf-8
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Thu, 28 Mar 2013 03:52:55 GMT
< Content-Length: 324
<
* Connection #0 to host epermit left intact
* Closing connection #0
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><xxxx xmlns="xxxxxxx" /></soap:Body></soap:Envelope>
을 그리고 :
* About to connect() to xxxxxxxxxxx port 8085 (#0)
* Trying 192.168.14.100... connected
> POST /xxxxxxx/xxxxxxx.asmx HTTP/1.1
> User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: xxxxxxxx:8085
> Accept: */*
> Content-Type:text/xml; charset=utf-8
> SOAPAction:"xxxxxxxxxxxxxxxxx"
> Content-Length: 1309
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
이것에 대한 어떤 생각을 요청 길이가 유효한 경우 다음 출력은?
덕분에,
서버 한도 여야합니다. 중복 된 http://stackoverflow.com/questions/2880722/is-http-post-limitless/2880766#2880766 및 기타 ... 검색 만하면됩니다. – DiogoSantana
필자는 Windows 컴퓨터에서 Fiddler2를 사용해 보았으므로 1308 바이트보다 큰 요청으로 정상적으로 작동하기 때문에 그럴 수는 없다고 생각합니다. 이것은 클라이언트 쪽 구성에 더 많은 것 같아요.하지만 어디에서 확인해야할지 모르겠습니다. –
서버에 액세스 할 수 있습니까? 다른 이더넷 프레임으로 넘칠 가능성이 있으며 서버가 제대로 처리하지 못합니다. – BevynQ