我正在使用Retrofit来执行POST请求。从邮递员测试我得到正确的答复。但是,当我通过我的应用程序发送相同的请求时,我得到响应500.下面是我的日志:
12-09 22:44:14.571 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:---> HTTP POST http://xyz/WebService/api/User/GetCompany 12-09 22:44:14.571 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Access-Control-Allow-Origin:* 12-09 22:44:14.571 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Token:JlkXkiBN3YHNLJtOBFT7aeRs1wgmo590SP + D5zA8eOaM0vl64odu / yZxYUGMAc1MKRs44av6naM = 12-09 22:44:14.571 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Content-Type:application / json 12-09 22:44:14.571 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Content-Length:2 12-09 22:44:14.571 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:{} 12-09 22:44:14.571 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:---> END HTTP(2字节正文) 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:< --- HTTP 500 http://xyzWebService/api/User/GetCompany(268ms) 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Cache-Control:no-cache 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Pragma:no-cache 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Content-Type:application / json;字符集= utf-8的 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Expires:-1 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:服务器:Microsoft-IIS / 8.5 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Set-Cookie:ASP.NET_SessionId = is5jp3wopax03vlu5ltlz1zz;路径= /;仅Http 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Access-Control-Allow-Origin:* 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Access-Control-Allow-Methods:* 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Access-Control-Allow-Headers:* 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:X-AspNet-Version:4.0.30319 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:X-Powered-By:ASP.NET 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:日期:2015年12月9日星期三17:14:06 GMT 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:Content-Length:4931 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:OkHttp-Selected-Protocol:http / 1.1 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:OkHttp-Sent-Millis:1449681254592 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:OkHttp-Received-Millis:1449681254847 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:{" Message":"发生错误。",&#34 ; ExceptionMessage":"无法执行查询\ r \ n [SELECT c.company_name,c.company_code \ n FROM {SECURITY_USER} .company $ module a,{SECURITY_USER} .module b,{SECURITY_USER}。 erp_company c,\ n {SECURITY_USER} .user $ company d,{SECURITY_USER} .jll $ user e,{SECURITY_USER} .erp_financial_year f \ n WHERE a.module_code = b.module_code \ n AND a.company_code = c.company_code \ n AND a.company_code = d.company_code \ n AND e.user_code = d.user_code \ n AND e.rec_status =' A' \ n AND d.user_code =:p0 \ n AND b.rec_status = ' A' \ n和f.company_code = c.company_code \ n - AND b.short_code =' SM' \ n group by c.company_name,c.company_code \ n ORDER BY c.company_name] \ r \ n名称:loginUsercode - 值:\ r \ n [SQL:SELECT c.company_name,c.company _code \ n FROM {SECURITY_USER} .company $ module a,{SECURITY_USER} .module b,{SECURITY_USER} .erp_company c,\ n {SECURITY_USER} .user $ company d,{SECURITY_USER} .jll $ user e,{SECURITY_USER} .erp_financial_year f \ n WHERE a.module_code = b.module_code \ n AND a.company_code = c.company_code \ n AND a.company_code = d.company_code \ n AND e.user_code = d.user_code \ n AND e.rec_status = ' A' \ n AND d.user_code =:p0 \ n AND b.rec_status =' A' \ n和f.company_code = c.company_code \ n - 和b.short_code =' SM' \ n group by c.company_name,c.company_code \ n ORDER BY c.company_name]"," ExceptionType":" NHibernate.Exceptions。 GenericADOException""堆栈跟踪":" at WebService.Common.Framework.Common.BaseApiController.ExecuteQuery [TParameters,TResult](TParameters参数)\ r \ n在WebService.Web.Controllers.API.UserController.GetCompany()\ r \ n在lambda_method(Closure,Object,对象[])\ r \ n在System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor。<> c__DisplayClass10.b__9(对象实例,Object [] methodParameters)\ r \ n在System.Web.Http.Controllers上。在System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext,IDictionary`2参数,CancellationToken cancellationToken)中反射了HttpActionDescriptor.ActionExecutor.Execute(Object instance,Object [] arguments)\ r \ n \ n \ n抛出异常的前一个位置的堆栈跟踪---在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n中的系统.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) r \ n在System.Web.Http.Contro llers.ApiControllerActionInvoker.d__0.MoveNext()\ r \ n ---从抛出异常的上一个位置开始的堆栈跟踪结束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n \ n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\ r \ n ---从上一个位置的堆栈跟踪结束抛出异常的地方--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n在System。 Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"," InnerException":{" Message":"发生错误。" ," ExceptionMessage":" ORA-00911:无效字符\ n"," ExceptionType":" System.Data.OracleClient.OracleException", "堆栈跟踪":"在System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle,Int32 rc)\ r \ n在System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle,CommandBehavior behavior,Boolean needRowid,OciRowidDescriptor& rowidDescriptor,ArrayList& resultParameterOrdinals) r \ n在System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle,CommandBehavi) 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:或behavior,ArrayList& System.Data.Common.DbCommand的System.Data.OracleClient.OracleCommand.ExecuteReader(CommandBehavior behavior)\ r \ n在System.Data.OracleClient.OracleClmand.OracleClient.Oracle上的System.Data.OracleClient.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)\ r NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)\ r \ n的.System.Data.IDbCommand.ExecuteReader()\ r \ n在NHibernate.Loader.Loader.GetResultSet(IDbCommand st,Boolean autoDiscoverTypes,Boolean callable,RowSelection selection) ,ISessionImplementor会话)\ r \ n在NHibernate.Loader.Loader.DoQuery(ISessionImplementor会话,QueryParameters queryParameters,Boolean returnProxies)\ r \ n在NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session,QueryParameters queryParameters,Boolean returnProxies)\ r \ n \ n在NHibernate.Loader.Loader.DoList(ISessionImplementor session,QueryParameters queryParameters)"}} 12-09 22:44:14.841 9191-10538 / com.employee.panorbit.logisticmanager D / Retrofit:< --- END HTTP(4931-byte body)
此处发布请求并不需要任何正文。我在请求中只发送标题。我尝试使用空JSON以及没有正文请求但是得到同样的错误。