2013-02-07 92 views
0

我正在開發iOS應用程序。 我在使用iOS中的MKNetwrokingKit庫向Java服務器發送「POST」請求時遇到問題。MKNetwroking問題,而iOS中的「POST」請求

服務器端的響應,我得到的是 -

2013-02-06 15:15:19,527 WARN [org.apache.tomcat.util.http.Parameters] (http-0.0.0.0-8443-3) Parameters: Invalid chunk ignored. 
2013-02-06 15:15:19,527 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/XtrWS].[Authentication]] (http-0.0.0.0-8443-3) Servlet.service() for servlet Authentication threw exception 
java.lang.IllegalArgumentException: No enum const class xtremum.health.us.api.generic.StaticVariable$ClientType.Praxify_151/1.0 CFNetwork/609 Darwin/12.2.0 
    at java.lang.Enum.valueOf(Enum.java:196) 
    at xtremum.health.us.api.generic.StaticVariable$ClientType.valueOf(StaticVariable.java:1) 
    at xtremum.health.us.webservice.Authentication.doPost(Authentication.java:169) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) 
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) 
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) 
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598) 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 
    at java.lang.Thread.run(Thread.java:662) 
2013-02-06 15:15:39,061 WARN [org.apache.tomcat.util.http.Parameters] (http-0.0.0.0-8443-3) Parameters: Invalid chunk ignored. 
2013-02-06 15:15:39,062 INFO [STDOUT] (http-0.0.0.0-8443-3) method name : login 
2013-02-06 15:15:39,062 INFO [STDOUT] (http-0.0.0.0-8443-3) I am in default case 
2013-02-06 15:15:39,062 INFO [xtremum.health.us.api.generic.StaticVariable] (http-0.0.0.0-8443-3) msg to client : 1405 
2013-02-06 15:15:39,062 DEBUG [xtremum.health.us.api.generic.StaticVariable] (http-0.0.0.0-8443-3) msg : {"msgToClient":1405} 
2013-02-06 15:16:41,437 WARN [org.apache.tomcat.util.http.Parameters] (http-0.0.0.0-8443-3) Parameters: Invalid chunk ignored. 

客戶端的響應是NSUrlErrorDomain 500

感謝

回答

0

錯誤500意味着它是服務器的一個內部錯誤。

這通常意味着服務器有一個例外,並能正確對待你的要求。當服務器編碼不正確時會發生這種情況。

但是,這並不是必要的,這意味着您的請求是'正確的': 讓我們設想一個POST請求,假設您發送您的登錄名和密碼。 想象一下,你的請求只發送一個登錄,服務器沒有正確編碼,並且在使用它之前不檢查2個變量,它將導致NullPointerException(在java中)。

反正你應該取得聯繫與負責serveur的人員,這樣他們可以調試您的要求,看看有什麼錯了,糾正,以避免一個錯誤500(其中shoulnd't發生)

同時,看着

java.lang.IllegalArgumentException異常:無枚舉常量類xtremum.health.us.api.generic.StaticVariable $ ClientType.Praxify_151/1.0 CFNetwork的/ 609達爾文/ 12.2.0

它看起來像一個認證離子錯誤,也許他們並沒有爲您的請求ClientType(或你忘記正確填寫此客戶端類型?)

你通過一些認證信息到服務器?