0

我正在开发一个 iOS 应用程序。在 iOS 中使用MKNetwrokingKit库向 Java 服务器发送“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

谢谢

4

1 回答 1

0

错误 500 表示这是服务器的内部错误。

这通常意味着服务器出现异常并且可以正确处理您的请求。当服务器未正确编码时,可能会发生这种情况。

但这并不一定意味着您的请求是“正确的”:让我们想象一个 POST 请求,您应该在其中发送您的登录名和密码。想象一下,您的请求只发送了一个登录信息,而服务器没有正确编码,并且在使用它之前没有检查 2 个变量是否存在,这将导致 NullPointerException(在 java 中)。

无论如何,您应该与负责服务器的人员联系,以便他们可以调试您的请求,查看错误并纠正它以避免错误 500(不应该发生)

同时,看着

java.lang.IllegalArgumentException:没有枚举常量类 xtremum.health.us.api.generic.StaticVariable$ClientType.Praxify_151/1.0 CFNetwork/609 Darwin/12.2.0

它看起来像一个身份验证错误,也许他们没有为您的请求创建 ClientType(或者您忘记正确填写此客户端类型??)

您是否将一些身份验证信息传递给服务器?

于 2013-02-07T09:18:31.240 回答