最近项目用到了webservice调用,之前没接触过,在网上找了好些天资料都是关于前端的,由于是别人的webservice跨域原因一直没调用成功,后来问了一下说要通过后台调用,只能重新找后台调用的方法 . 我找到了这篇文章比较符合我的需求
https://blog.csdn.net/wanggsx918/article/details/19153961.
我复制过来使用的时候发现报错,响应为false.我又参考了这篇文章
https://blog.csdn.net/sinat_21946155/article/details/51144945
发现之前的文章里面的
JSONObject args = new
JSONObject();
args.put(
"method"
,
"open"
);
out.writeBytes(args.toString());
out.writeBytes(args.toString());这个写的有些问题需要修改,应该写成这个样子:
args.put(
"method"
,
"open");
out.writeBytes("method="+args.toString());
下面是