我正在使用volley stringrequest发送帖子请求,代码如下:
StringRequest request = new StringRequest(Request.Method.POST, StaticConstant.LOGIN_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("Where","inside Response"+response.toString());
loginCallback.onLoginSuccess(true,response.toString());
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error)
{
Log.e("Where","inside error Response"+error.getMessage());
error.printStackTrace();
}
}){
@Override
protected Map<String,String> getParams(){
Map<String, String> params = new HashMap<String, String>();
params.put("inputtype","json");
params.put("inputstring", "{\"AuthenticateVendorRQ\":{\"Credentials\":{\"APIKey\":\"\",\"CompanyCode\":\"\",\"VendorCode\":\"1\"}}}");
params.put("responsetype", "xml");
return params;
}
回调( loginCallback.onLoginSuccess(true,response.toString()))没有在我正在使用它的类中获取String响应值。 基于.net的webservice的响应是:
<string xmlns="http://tempuri.org/">
{"AuthenticateVendorRS":{"Status":"FAIL","ErrorCode":"","ErrorMessage":""}}
</string>
我的问题是当它在onResponse(字符串响应)时为什么响应值不存在?有人能帮助我吗?