排球到NHibernate的POST请求不起作用

时间:2019-03-21 10:49:56

标签: android android-volley

在我的Android应用程序中,我正在使用volley通过NHibernate将请求发送到服务器。我的问题是此请求适用于SDK版本26,但不适用于SDK版本23,21。我没有在其他SDK中进行测试。这些是真实的设备,不是模拟器。我将JSON字符串嵌入到URL中。这在POSTMAN中也很好用。

这是日志。....

03-21 15:54:45.440 11423-11423/button_list.example.sanjeewa.myapplication D/ViewRootImpl: ViewPostImeInputStage processPointer 0
03-21 15:54:45.520 11423-11423/button_list.example.sanjeewa.myapplication D/ViewRootImpl: ViewPostImeInputStage processPointer 1
03-21 15:54:45.525 11423-11423/button_list.example.sanjeewa.myapplication D/ListAsString :: [{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"4","SSUFFIX":"1","seqDes":"HOOD CLOTH (ORIGINAL)"},{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"5","SSUFFIX":"1","seqDes":"LHS SIGNAL LIGHT"}]
03-21 15:54:45.525 11423-11423/button_list.example.sanjeewa.myapplication D/new_url :: http://203.115.11.236:10155/Nh-1/api/GetLetter/UpdateSalvage?salvageItem=[{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"4","SSUFFIX":"1","seqDes":"HOOD CLOTH (ORIGINAL)"},{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"5","SSUFFIX":"1","seqDes":"LHS SIGNAL LIGHT"}]
03-21 15:54:45.525 11423-11786/button_list.example.sanjeewa.myapplication I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
03-21 15:54:45.525 11423-11786/button_list.example.sanjeewa.myapplication I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
03-21 15:54:45.525 11423-11786/button_list.example.sanjeewa.myapplication I/qtaguid: Tagging socket 40 with tag 9be9211900000000{2615746841,0} uid -1, pid: 11423, getuid(): 10166
03-21 15:54:45.565 11423-11786/button_list.example.sanjeewa.myapplication I/qtaguid: Untagging socket 40
03-21 15:54:45.565 11423-11786/button_list.example.sanjeewa.myapplication E/Volley: [5058] BasicNetwork.performRequest: Unexpected response code 400 for http://203.115.11.236:10155/Nh-1/api/GetLetter/UpdateSalvage?salvageItem=[{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"4","SSUFFIX":"1","seqDes":"HOOD CLOTH (ORIGINAL)"},{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"5","SSUFFIX":"1","seqDes":"LHS SIGNAL LIGHT"}]
03-21 15:54:45.565 11423-11423/button_list.example.sanjeewa.myapplication D/EEEEEE: com.android.volley.ClientError

URL ......

"http://203.115.11.236:10155/Nh-1/api/GetLetter/UpdateSalvage?salvageItem=[{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"4","SSUFFIX":"1","seqDes":"HOOD CLOTH (ORIGINAL)"},{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"5","SSUFFIX":"1","seqDes":"LHS SIGNAL LIGHT"}]"

JSON字符串......  [{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"4","SSUFFIX":"1","seqDes":"HOOD CLOTH (ORIGINAL)"},{"SCLAIMNO":"V/CH/1/068/1000020/2016","SRECEIVED_BRANCH":19,"SRECEIVED_BY":"SEC7918","SSEQUENCE":"5","SSUFFIX":"1","seqDes":"LHS SIGNAL LIGHT"}]

方法...

protected void AcceptReceivedSalvageItem(String url) {

    String new_url = url + ListAsString;

    StringRequest stringRequest = new StringRequest(Request.Method.POST, new_url, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.d("SSSS", response);
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            Log.d("EEEEEE", error.toString());
        }
    });

    queue.add(stringRequest);

}

C#代码....

[HttpPost]
[Route("api/GetLetter/UpdateSalvage")]
public async Task<IHttpActionResult> UpdateSalvage(string salvageItem)
{
    DataTransaction dataTransaction = new DataTransaction();

    if (dataTransaction.UpdateSalvageCollection(salvageItem))
        return Ok();
    else
        return NotFound();
}

0 个答案:

没有答案