需求:数据库中表数据的变动,触发调用某个HTTP接口
步骤1:在ORACLE中创建JAVA程序并编辑(ORACLE 11g ),参数需根据实际需求修改
create or replace and compile java source named esb.HttpPost as
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
/**
* Created by wl on 2017/9/19.
*/
public class HttpPost {
public static void doPostStatus(String url,String barcode,String patno,String status) throws Exception {
String data =barcode+"&"+patno+"&"+status;
URL localURL = new URL(url);
URLConnection connection = localURL.openConnection();
HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("Accept-Charset", "utf-8");
httpURLConnection.setRequestProperty("Content-Type", "application/json");
httpURLConnection.setRequestProperty("Content-Length", String.valueOf(data.length()));
OutputStream outputStream = null;
OutputStreamWrit