package org.jfox.ejb.invoker.soap;
import java.rmi.RemoteException;
import org.jfox.ejb.Invocation;
import org.jfox.ejb.meta.Protocol;
import org.jfox.ejb.invoker.ContainerRemote;
import org.jfox.ejb.invoker.ContainerServiceSupport;
public class SOAPContainerService extends ContainerServiceSupport implements ContainerRemote {
private String protocol = Protocol.SOAP;
private String httpHost = "";
private int httpPort = 8080;
private String servletName = "xmlrpc/RPC2";
private SOAPContainerServiceBinder soapBinder = null;
public String getHttpHost() {
return httpHost;
}
public int getHttpPort() {
return httpPort;
}
public String getServletName() {
return servletName;
}
public void setHttpHost(String httpHost) {
this.httpHost = httpHost;
}
public void setHttpPort(int httpPort) {
this.httpPort = httpPort;
}
protected void doStart() throws Exception {
logger.info("soap url: " + getSoapURL());
INITIAL_CONTEXT.rebind(INVOKER_JNDI_PREFIX + "/" + protocol.toUpperCase(),soapBinder);
}
protected void doStop() throws Exception {
INITIAL_CONTEXT.unbind(INVOKER_JNDI_PREFIX + "/" + protocol.toUpperCase());
}
protected void doInit() throws Exception {
super.doInit();
soapBinder = new SOAPContainerServiceBinder(getSoapURL());
}
protected void doDestroy() throws Exception {
soapBinder = null;
}
public String getSoapURL(){
return "http://"+httpHost+":"+httpPort+"/"+servletName;
}
public Object invoke(Invocation invocation) throws RemoteException {
return soapBinder.invoke(invocation);
}
public static void main(String[] args) {
}
}