string GetOrder(string message)
输入参数的类型格式为 xml 返回的参数也为 xml
我用的是volley框架通过post传参数调用的,但是参数可以为空的时候就返回成功的值,参数不为空的时候就返回参数不能为空的说明,就是参数没有传上去,求解 为什么啊 有没有大佬遇到相同的问题啊 跪求
输入参数的类型格式为 xml 返回的参数也为 xml
我用的是volley框架通过post传参数调用的,但是参数可以为空的时候就返回成功的值,参数不为空的时候就返回参数不能为空的说明,就是参数没有传上去,求解 为什么啊 有没有大佬遇到相同的问题啊 跪求
OutputStreamWriter outputStreamWriter=null;
InputStreamReader inputStreamReader=null;
HttpURLConnection connection=null;
StringBuffer buffer=new StringBuffer();
try {
URL url=new URL("请求地址");
connection=(HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset:utf-8");
connection.connect();
outputStreamWriter=new OutputStreamWriter(connection.getOutputStream(), "utf-8");
outputStreamWriter.write(data);
outputStreamWriter.flush();
inputStreamReader =new InputStreamReader(connection.getInputStream(), "utf-8");
BufferedReader reader=new BufferedReader(inputStreamReader);
String str;
while ((str=reader.readLine())!=null) {
buffer.append(str);
}
connection.disconnect();
} catch (Exception e) {
System.out.println(e.getMessage());
}finally{
try {
outputStreamWriter.close();
inputStreamReader.close();
connection.disconnect();
} catch (Exception e2) {
// TODO: handle exception
}
}
return buffer.toString();
}