首页 \ 问答 \ Android Volley ServerError(Android Volley ServerError)

Android Volley ServerError(Android Volley ServerError)

在这里输入图像描述 我将所有字符串的数据发布到服务器中的varchar变量,但我得到凌乱的服务器错误或badnetwork性能错误417。

我正在使用以下功能来调用服务器,如果出现错误,请帮我解决。

public void signUpWS() {
    avi.show();

    StringRequest strReq = new StringRequest(StringRequest.Method.POST, Constants.SIGN_UP, new Response.Listener<String>() {


        @Override
        public void onResponse(String response) {
            Snackbar.make(mainlayout, response.toString(), Snackbar.LENGTH_LONG).show();
            Log.e("Responce from server", response.toString());
            avi.hide();
            if (!response.toString().contains("User")) {
                spEdit.putString(getString(R.string.uaccount), response.toString());
                spEdit.commit();
                Intent intent = new Intent(SignUp.this, Products.class);
                intent.putExtra(getString(R.string.uemail), Email_Address);
                intent.putExtra(getString(R.string.uphone), Phone_Number);
                intent.putExtra(getString(R.string.upass), Password);
                startActivity(intent);
                finish();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            avi.hide();
            Log.e("Volley Error", error.toString());
            if (error.toString().contains("NoConnectionError")) {
                Snackbar.make(mainlayout, "Internet Not Available!", Snackbar.LENGTH_LONG).show();
            } else {
                Snackbar.make(mainlayout, "Webservice not responding!", Snackbar.LENGTH_LONG).show();
            }
        }
    }) {
       @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String, String> headers = new HashMap<>();
            headers.put("Content-Type", "application/json; charset=utf-8");
            return headers;
        }

        @Override
        protected Map<String, String> getParams() throws AuthFailureError {
            Map<String, String> data = new HashMap<String, String>();
            String name[] = Name.split(" ");
            String first = "", last = "";
            boolean firstb = true;
            for (int i = 0; i < name.length; i++) {
                if (firstb) {
                    first += name[i];
                    firstb = false;
                } else {
                    if (i == name.length - 1) {
                        last = name[i];
                    } else {
                        first += " ";
                        first += name[i];
                    }
                }
            }
            data.put("FirstName", first);
            data.put("LastName", last);
            data.put("LoginName", Login_Name);
            data.put("PrimaryEmail", Email_Address);
            data.put("PrimaryPasscode", Encrypted_Password);
            data.put("SecondaryPasscode", Encrypted_Password);
            data.put("PhoneNumber", Phone_Number);
            data.put("PrimaryCellNumber", Phone_Number);
            data.put("AccountType", UserType);
            data.put("ProfileRateSequence", "" + 0);
            data.put("MemberShipType", "BASIC");
            data.put("CityName", "null");
            data.put("CountryId", "" + 0);
            data.put("StateId", "" + 0);
            data.put("IsVerified", "" + 1);
            data.put("IsBlocked", "" + 0);
            data.put("IsBlackListed", "" + 0);
            data.put("IsActive", "" + 1);
            data.put("IsDeleted", "" + 0);

            return data;
        }
    };

    AppController.getInstance().addToRequestQueue(strReq, REQ_TAG);
}[![The Error which i get on logcat.][1]][1]

enter image description hereI am posting data all strings to varchar variables in server, but i am getting volley server error or badnetwork performance error 417.

I am using the following fuction to call the server, help me out if there is an error.

public void signUpWS() {
    avi.show();

    StringRequest strReq = new StringRequest(StringRequest.Method.POST, Constants.SIGN_UP, new Response.Listener<String>() {


        @Override
        public void onResponse(String response) {
            Snackbar.make(mainlayout, response.toString(), Snackbar.LENGTH_LONG).show();
            Log.e("Responce from server", response.toString());
            avi.hide();
            if (!response.toString().contains("User")) {
                spEdit.putString(getString(R.string.uaccount), response.toString());
                spEdit.commit();
                Intent intent = new Intent(SignUp.this, Products.class);
                intent.putExtra(getString(R.string.uemail), Email_Address);
                intent.putExtra(getString(R.string.uphone), Phone_Number);
                intent.putExtra(getString(R.string.upass), Password);
                startActivity(intent);
                finish();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            avi.hide();
            Log.e("Volley Error", error.toString());
            if (error.toString().contains("NoConnectionError")) {
                Snackbar.make(mainlayout, "Internet Not Available!", Snackbar.LENGTH_LONG).show();
            } else {
                Snackbar.make(mainlayout, "Webservice not responding!", Snackbar.LENGTH_LONG).show();
            }
        }
    }) {
       @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String, String> headers = new HashMap<>();
            headers.put("Content-Type", "application/json; charset=utf-8");
            return headers;
        }

        @Override
        protected Map<String, String> getParams() throws AuthFailureError {
            Map<String, String> data = new HashMap<String, String>();
            String name[] = Name.split(" ");
            String first = "", last = "";
            boolean firstb = true;
            for (int i = 0; i < name.length; i++) {
                if (firstb) {
                    first += name[i];
                    firstb = false;
                } else {
                    if (i == name.length - 1) {
                        last = name[i];
                    } else {
                        first += " ";
                        first += name[i];
                    }
                }
            }
            data.put("FirstName", first);
            data.put("LastName", last);
            data.put("LoginName", Login_Name);
            data.put("PrimaryEmail", Email_Address);
            data.put("PrimaryPasscode", Encrypted_Password);
            data.put("SecondaryPasscode", Encrypted_Password);
            data.put("PhoneNumber", Phone_Number);
            data.put("PrimaryCellNumber", Phone_Number);
            data.put("AccountType", UserType);
            data.put("ProfileRateSequence", "" + 0);
            data.put("MemberShipType", "BASIC");
            data.put("CityName", "null");
            data.put("CountryId", "" + 0);
            data.put("StateId", "" + 0);
            data.put("IsVerified", "" + 1);
            data.put("IsBlocked", "" + 0);
            data.put("IsBlackListed", "" + 0);
            data.put("IsActive", "" + 1);
            data.put("IsDeleted", "" + 0);

            return data;
        }
    };

    AppController.getInstance().addToRequestQueue(strReq, REQ_TAG);
}[![The Error which i get on logcat.][1]][1]

原文:https://stackoverflow.com/questions/42365565
更新时间:2022-06-22 12:06

最满意答案

您需要选中该框以使库可用于您的项目。 通过导出这些jar,您可以将它们用于引用该库的任何项目。

“Eclipse Freezing”是什么意思? 它只是一个新的模拟器需要很长时间> 30分钟才能启动? 这在平均的窗户盒子上并不罕见。 如果没有,请检查错误日志。


You need to check that box to make the library available to your project. By exporting those jars you are making them available to any project that references that library.

What do you mean by "Eclipse Freezing" ? Is it just a new emulator taking a long time > 30 mins to start ? That would not be unusual on an average windows box. If not, check the error logs .

相关问答

更多
  • 您收到错误是因为您的'this'操作符指向new AdapterView.OnItemSelectedListener() (您创建的新侦听器)。 要修复此替换为: .this 。 此外,我不确定你要做什么,但在听众中对新的adpater进行贴花并不是一个好主意。 最好在那里初始化它。 You are getting the error because your 'this' operator points to new AdapterView.OnItemSelectedLi ...
  • 以下是实现此目的的两种方法。 1)通过在包含Cell 的Row上调用removeCell来删除单元Cell 。 这也将删除单元格上的任何格式或样式。 row.removeCell(cellToMakeEmpty); 2)使用Cell的setCellType方法将单元格的单元格类型设置为CELL_TYPE_BLANK 。 这将清除单元格上的任何值,但它保持格式和样式完整。 cellToMakeEmpty.setCellType(Cell.CELL_TYPE_BLANK); Here are two way ...
  • Android正在使用与Java正则表达式引擎略有不同的ICU正则表达式库。 看到这个参考 : Unicode脚本,块,类别和二进制属性使用Perl中的\p和\P结构编写。 如果输入具有属性prop,则\p{prop}匹配,而如果输入具有该属性,则\P{prop}不匹配。 因此,模式应该写成 Pattern nonAlphabeticPattern = Pattern.compile("\\P{L}"); Android is using ICU regex library that is a bit ...
  • 根据此Apache POI FAQ条目 , 不支持在不同版本之间混合POI jar,并且会以各种方式中断,例如您找到的那些。 不要这样做! 您需要在同一版本中使用所有POI罐。 我建议最新版本,可在此处获取 (目前为3.15) 您还应该查看组件及其依赖项页面 ,以确保您拥有使用Apache POI所需的所有jar文件。 好吧,或使用像Maven或Gradle这样的依赖管理工具为您处理! As per this Apache POI FAQ entry, mixing POI jars between dif ...
  • Apache POI提供了一个组件页面 ,其中详细介绍了项目的所有不同部分,您需要什么样的jar以及您需要的Maven工件。 如果你看那里,你会看到以下内容: |Component | Application type | Maven artifactId | Notes |Common SS | Excel XLS and XLSX | poi-ooxml | WorkbookFactory and friends all require poi-ooxml, not just core poi | ...
  • 您需要选中该框以使库可用于您的项目。 通过导出这些jar,您可以将它们用于引用该库的任何项目。 “Eclipse Freezing”是什么意思? 它只是一个新的模拟器需要很长时间> 30分钟才能启动? 这在平均的窗户盒子上并不罕见。 如果没有,请检查错误日志。 You need to check that box to make the library available to your project. By exporting those jars you are making them availab ...
  • 检查您的manifest.hda并确保将“Component Name”/ libs添加为componentExtra或componentLib,否则这些libs库将不会在组件安装时部署到内容服务器的文件系统(因此这些类将不会在运行)。 如果您查看有问题的user_project的WCC实例的文件系统,则可以检查此假设。 类加载器可能包含已加载的一个SAX实现的类。 尝试从类路径中完全删除xml-apis-1.0.b2.jar。 我敢打赌,在兼容的类路径中已经存在竞争的SAX实现。 Check your m ...
  • Apache POI JAR文件不在您的运行时类路径上。 使用MANIFEST.MF文件中的以下清单条目重建Test.jar Class-Path: poi-3.9-20121203.jar The Apache POI JAR file is not on your runtime classpath. Rebuild Test.jar with the following manifest entry in the MANIFEST.MF file Class-Path: poi-3.9-201212 ...
  • 将评论提升为答案... Apache POI具有少量依赖关系 ,这些依赖关系完全列在网站的“ 组件”页面上。 您需要包含您正在使用的任何POI模块的依赖项。 在您的情况下,您获得的异常表明Commons Codec库缺失,并补充说明了解决问题。 Promoting a comment to an answer... Apache POI has a small number of dependencies, which are fully listed on the Components page on t ...
  • 我们当然可以在Android中移植Apache POI API。 我做的示例代码是在Apache POI的帮助下计算功率点演示中的幻灯片数量。 We can certainly port Apache POI API in Android. The example code that i made is to count the number of slides in a power point presentation with the help of Apache POI.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)