webservice 和 rest 接口 请求,设置请求类型 以及 Authorization 认证
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
//发送
public class Send {
public String sendrequest(String json) throws MalformedURLException, IOException {
//创建一个支持HTTP特定功能的URLConnection
HttpURLConnection httpConn = null;
//创建一个输出流对象
OutputStream out = null;
String returnXml = "";
//异步接口的地址
String SapPiUrl = "";
try {
String querySql = "select sap_dataurl from hdl_requesturl";
//SapPiUrl = DBHelper.getFirstColCommon(1, 1, false, querySql);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String dz = SapPiUrl;
//打开链接
httpConn = (HttpURLConnection) n