package com.eactive.eai.control;

import java.util.Properties;

import com.eactive.eai.adapter.ElinkAdapter;
import com.eactive.eai.adapter.ElinkAdapterFactory;

public class WebTSender {
	
	static final String WEBT_CONTROL_ERROR = "RECEAIOWC001";
    
    public static byte[] callService(String adapterGroupName, Properties prop,  Object message, Properties tempProp) throws java.lang.Exception
    {
        byte[] resBytes;        
        try {
        	//new socket 과 old socket을 분기 하기 위해서
        	String protocol = (String)prop.getProperty("protocol");
        	
        	
            ElinkAdapterFactory factory = ElinkAdapterFactory.newInstance();            
            ElinkAdapter adapter = null;
           	adapter = factory.getElinkAdapter(com.eactive.eai.adapter.Keys.TYPE_WBT);
            if(prop==null) {
                prop = new Properties();
            }
            if(prop.getProperty("ADAPTER_GROUP_NAME") == null) {            
                prop.setProperty("ADAPTER_GROUP_NAME", adapterGroupName);
            }
            resBytes = (byte[])adapter.callService(adapterGroupName, prop, message, tempProp);
        } catch(Exception e) {
            throw e;
        }
        return resBytes;
    }
}
