00001 package clientswing.comunicationsystem;
00002
00003 import clientswing.model.XRequestLogin;
00004
00005 import org.jaebi.client.ws.*;
00006 import javax.xml.rpc.ServiceException;
00007 import java.rmi.*;
00010 public class SOAPGateway implements Gateway{
00011
00012 int sessionId;
00013 org.jaebi.client.ws.JAEBIWSSEI binding;
00014
00016 public SOAPGateway() throws ServiceException {
00017
00018 binding = new JAEBIWS_Impl().getJAEBIWSSEIPort();
00019
00020 }
00021
00022 public String sendRequest(String request) {
00023
00024 java.lang.String value = null;
00025 try{
00026
00027 value = binding.executeRequest(sessionId, request);
00028 }catch(Exception e){
00029 e.printStackTrace();
00030 return null;
00031 }
00032 return value;
00033
00034 }
00035
00036
00037 public int sendLogin(XRequestLogin login) {
00038
00039 int value = 0;
00040
00041 try {
00042 value = binding.login(login.getNickName(), "normal");
00043 sessionId = value;
00044 System.out.println("++++++++++++++"+sessionId+"++++++");
00045 }
00046 catch (RemoteException ex) {
00047 ex.printStackTrace();
00048 return -99;
00049 }
00050 return value;
00051 }
00052
00056 public String logout() {
00057 String value = "";
00058
00059 try {
00060 value = binding.logout(sessionId);
00061 }
00062 catch (RemoteException ex) {
00063 ex.printStackTrace();
00064 return null;
00065 }
00066 return value;
00067
00068 }
00069
00070 }