Paul:

Any suggestion on how to further debug these problems:

1. missing/corrupted http header sent by XmlRpcClientLite from IBM unix
under Websphere, while XmlRpcClient works ok.
2. WebServer hangs and refuse new connections, regardless of XmlRpcClient or
XmlRpcClientLite.

Could it be in my webserver code? I have attached my webserver code below.

Thanks.

- Yaxiong


package mss.service;
import mss.appenv.*;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.xmlrpc.*;
import com.i2.rv.framework.*;
import com.i2.rv.framework.ros.*;
import com.i2.rv.framework.ros.ocl.Connection;

/**
 * Provides the access to the scheduling optimizer engine.  
 * @author Yaxiong Lin
 * @version 1.0
 * @since jdk 1.3
 */
public class SchedMarsBaseServer {
        
        /**
         * Config object
         */
        protected static mss.appenv.SchedConfigBean configObj;

        /**
         * optimizer engine host name
         */
        protected String marsHost;

        /**
         * server name, to be used to identify this server when multiple
instances are started
         */
        protected String serverName;
        
        /**
         * optimizer engine listening port; if not specified, default to
defaultPort
         * @see #defaultPort
         */
    protected int marsPort;
                
        /**
         * mars control port
         */
        protected int marsControlPort;
        
        /**
         * if server object is ready/valid to service the request
         */
        protected boolean isValid = false;

        protected MSSDebug debugger;

        protected static String serviceObjName = "mars";
        
        /**
         * logs the application message through debugger object.  It
recognizes the current
         * (decendant) class name.  This method is used by the non static
method.
         */
        public void logMsg (int logLevel_p, String msgText_p) {
                if (debugger != null) debugger.logMsg (logLevel_p,
getClass().getName(), msgText_p);
                return;
        }

        /**
         * constructor to create the server object
         */
        public SchedMarsBaseServer (WebServer webServer_p) {
                try {
                        serverName = configObj.getProperty
("MARSBASESERVERNAME", "???");
                        logMsg (MSSDebug.IMPORTANT, "******* Connecting to
Mars, any error, check the config file first *******");
        
Integer.parseInt(configObj.getProperty("MARSBASEPORT","???"));
                        marsHost = configObj.getProperty("MARSHOST","???");
                        marsPort =
Integer.parseInt(configObj.getProperty("MARSPORT","???"));
                        marsControlPort =
Integer.parseInt(configObj.getProperty("MARSCONTROLPORT","???"));
                        
                        debugger = new
mss.appenv.MSSDebug(configObj.getAppEnv(), serverName,
configObj.getDebugLevel());
                        logMsg (MSSDebug.IMPORTANT, serverName+" marsHost:"
+ marsHost + ", marsPort#:" + String.valueOf(marsPort));
                        isValid = true;
                        webServer_p.addHandler(serviceObjName, this);
                }
                catch (Exception e) {
                        logMsg (MSSDebug.ERROR, "Error in mars object
constructor, check properties MARSBASESERVERNAME, MARSBASEPORT, MARSHOST,
MARSPORT, MARSCONTROLPORT in ini file.");               
                }
                return;
        }

        
        
        /**
         * main used to start up the application as a standalone server.
         * @param args[0] register hanlder name, e.g. mars.
         * @param args[1] listen port number, e.g. 8083
         */
    public static void main (String [] args) {
        try {
                        System.out.println ("******* Loading configuration
from " + args[0] + " in the current folder *********");
                        System.out.println ("******* Examine the log file
for any error!!! *********");
                        configObj = new mss.appenv.SchedConfigBean();
                        try {configObj.setConfigFile (null, args[0]);}
                        catch (Exception e) {
                                System.out.println ("******** Invalid config
file ********");
                                throw new MSSException (0, "Invalid config
file (content) " + args[0]);
                        }
                        String tempServerName = configObj.getProperty
("MARSBASESERVERNAME", "???");
                        MSSDebug tempDebugger = new
mss.appenv.MSSDebug(configObj.getAppEnv(), "marsBaseServer",
configObj.getDebugLevel());
                        tempDebugger.logMsg (MSSDebug.IMPORTANT,
"SchedMarsBaseServer.main("+tempServerName+")", "********  ENVIRONMENT= " +
configObj.getAppEnv());
                        tempDebugger.logMsg (MSSDebug.IMPORTANT,
"SchedMarsBaseServer.main("+tempServerName+")", "********  DEBUGLEVEL= " +
String.valueOf(configObj.getDebugLevel()));
                        int listenPortNum =
Integer.parseInt(configObj.getProperty("MARSBASEPORT", "???"));
                        String tempString;
                        tempString =
configObj.getProperty("XMLRPCDEBUG","N");
                        tempDebugger.logMsg (MSSDebug.IMPORTANT,
"SchedMarsBaseServer.main("+tempServerName+")", "********  XMLRPCDEBUG= " +
tempString);
        
XmlRpc.setDebug(MSSUtility.stringToBoolean(tempString));
                        tempString = configObj.getProperty("XMLRPCENCODING",
"???");
                        tempDebugger.logMsg (MSSDebug.IMPORTANT,
"SchedMarsBaseServer.main("+tempServerName+")", "********  XMLRPCENCODING= "
+ tempString);
                    XmlRpc.setEncoding(tempString);
            WebServer server = new WebServer(listenPortNum);
                        tempDebugger.logMsg (MSSDebug.IMPORTANT,
"SchedMarsBaseServer.main("+tempServerName+")", "********  Listen Port#= " +
String.valueOf(listenPortNum));
                        SchedMarsBaseServer marsHandlerObj =  new
SchedMarsBaseServer (server);
                        if (marsHandlerObj.isValid) {
                                tempDebugger.logMsg (MSSDebug.ALWAYS,
"SchedMarsBaseServer.main("+tempServerName+")", "Phobos is saying hi ...");
                        }
                        else {
                                tempDebugger.logMsg (MSSDebug.ERROR,
"SchedMarsBaseServer.main("+tempServerName+")", "unable to create
marsHandlerObj!");
                        }
        } catch (Exception exception) {
            System.out.println("SchedMarsBaseServer: " +
exception.toString());
                        System.out.println("command line params:
iniFileName.  e.g. java SchedMarsBaseServer dev.ini");
        }
    }

        /**
         * Submits the request to mars and returns the results in hashtable
back to
         *   the calling app.  The hashtable contains two elements:
         *      <ol>
         *              <li>hashtable, key = "header": 
         *                      <ul>
         *                              <li>errorCode: Integer, 1 - success,
0 - non mars error (details see errorMessage),
         *                                      and other numbers - mars
return code</li>
         *                              <li>errorMessage: String, error
message</li>
         *                              <li>lastCommand: String, last mars
command sent to mars</li>
         *                              <li>schedStatus: Boolean </li>
         *                      </ul>
         *              </li>
         *              <li>vector, key = "result":
         *              </li>
         *      </ol>
         * @param schedRequest_p scheduling request
         * @exception MSSException any error
         * @return trans ID
         * @see mss.service.SchedRequestData
         */     
        public java.util.Hashtable submitRequest (java.util.Vector cmdList)
{
                java.util.Hashtable returnObj = new java.util.Hashtable(2);
                java.util.Hashtable headerObj = new java.util.Hashtable(5);
                Object ROSReturnObj;
                IROSEvaluator ROSEvaluator;             
                Connection conROS = null;
                returnObj.put("header", headerObj);
                String tempString;
                headerObj.put("schedStatus", new Boolean(false));
                logMsg (MSSDebug.INFORMATIONAL, "submitRequest:" + cmdList);
                if (cmdList==null || cmdList.size()<=0) {
                        // returns a header record indicate missing commands
                        headerObj.put("errorCode", new Integer (0));
                        headerObj.put("errorMessage", "empty command list");
                        disconnectMars(conROS);
                        return returnObj;
                }

                String transID = "???";
                try {   
                        conROS = initialize(marsPort);
                        logMsg (MSSDebug.INFORMATIONAL+2, "Creating Mars
Evealuator object.");
                        ROSEvaluator = (IROSEvaluator)
conROS.createEvaluator();
                }
                catch(FWException e) {
                        logMsg (MSSDebug.ALWAYS, "Mars exception: type=" +
e.getType()
                                + "/ code=" + e.getCode() + "/Msg=" +
e.getMessage());
                        headerObj.put("lastCommand", "connect");
                        headerObj.put("errorCode", new
Integer(e.getCode()));
                        headerObj.put("errorMessage", e.getMessage());
                        disconnectMars(conROS);
                        return returnObj;
                }
                
                // run commands one at a time and stop on any error
                boolean commandStatus = true;
                for (int i=0; commandStatus && i<cmdList.size(); i++) {
                        String cmdString = (String) cmdList.elementAt(i);
                        String cmdCode = cmdString.substring(0,
cmdString.indexOf("("));
                        logMsg(MSSDebug.INFORMATIONAL, "submitRequest:"+
cmdString);
                        if (cmdCode==null || cmdCode.equals("")) {
                                headerObj.put("errorCode", new Integer (0));
                                headerObj.put("errorMessage", "blank/null
command");
                                disconnectMars(conROS);
                                return returnObj;
                        }
                        cmdCode = cmdCode.trim();
                        int idx = cmdString.indexOf("@transID@");
                        if (idx>0) cmdString = cmdString.substring(0,idx) +
transID + cmdString.substring(idx+9);
                        try {
                                ROSReturnObj = ROSEvaluator.expression
(cmdString);
                                if (ROSReturnObj==null) {
                                        logMsg (MSSDebug.ALWAYS, "Mars
returned null object!");
                                        headerObj.put("lastCommand",
cmdString);
                                        headerObj.put("errorCode", new
Integer (0));
                                        headerObj.put("errorMessage",
"command " + cmdString + " returned null from mars");
                                        disconnectMars(conROS);
                                        return returnObj;
                                }
                        }
                        catch(FWException e) {
                                logMsg (MSSDebug.ALWAYS, "Mars exception:
type=" + e.getType()
                                        + "/ code=" + e.getCode() + "/Msg="
+ e.getMessage());
                                headerObj.put("lastCommand", cmdString);
                                headerObj.put("errorCode", new
Integer(e.getCode()));
                                headerObj.put("errorMessage",
e.getMessage());
                                disconnectMars(conROS);
                                return returnObj;
                        }
                        catch (Exception e) {
                                logMsg (MSSDebug.ALWAYS, "Non Mars
Exception: " + e.getMessage());
                                headerObj.put("lastCommand", cmdString);
                                headerObj.put("errorCode", new Integer (0));
                                headerObj.put("errorMessage", "command " +
cmdString + " failed: " + e.getMessage());
                                disconnectMars(conROS);
                                return returnObj;
                        }
                
                        if (cmdCode.equalsIgnoreCase("new_order_set")) {
                                transID = ((Integer)
ROSReturnObj).toString();
                                headerObj.put("transID", transID);
                                logMsg (MSSDebug.INFORMATIONAL+2, "transID
returned: " + transID);
                        }
                } // for loop

                java.util.Vector resultObj = new java.util.Vector();
                returnObj.put("result", resultObj);
                getResult (transID, headerObj, resultObj);
                disconnectMars(conROS);
                return returnObj;
        }
        
        /**
         * Forces the server to exit with the code, message passed in.
         * @param exitCode_p code to be passed to the System.exit call
         * @param exitMsg_p message to be sent to the oncall and logged to
the system log file
         */
        public void shutDown (int exitCode_p, String exitMsg_p) {
                logMsg (MSSDebug.ALWAYS, serverName + " is told to say good
bye: " + exitMsg_p + "; code=" + String.valueOf(exitCode_p));
                System.exit(exitCode_p);
                return;
        }

        /**
         * returns a string containing this server's attribute; use this
function to check
         *   if server is up and responding or get server configuation
params
         * @preturn String containing the server's vital attributes
         */
        public String ping () {
                StringBuffer tempBuf = new StringBuffer(serverName);
                tempBuf.append(": SchedMarsBaseServer {");
                tempBuf.append("marsHost=").append(marsHost);
                tempBuf.append(", serverName=").append(serverName);
                tempBuf.append(", marsPort=").append(marsPort);
                tempBuf.append(",
marsControlPort=").append(marsControlPort);
                tempBuf.append("}");
                return tempBuf.toString();
        }
                
        /**
         * obtains results from mars for the specified tran id
         * @param transID String containing transaction ID on Mars
         * @param headerObj containing the header attributes to be returned
back to the calling app
         * @param resultObj to be populated by this method with the results
         * @return boolean true if success, false on any error
         */
        protected boolean getResult (String transID, java.util.Hashtable
headerObj, java.util.Vector resultObj) {
                Connection conROS = null;
                ICursor ROSCursor;

                int ROSreturnStatus;
                Integer tempInteger;
                Long tempLong;
                int tempInt;
                Object ROSReturnObj, tempObj;
                String scheduleStatus, tempString;
                java.util.Date utilDate;
                Hashtable rowAttributeList;
                
                StringBuffer tempStringBuf = new StringBuffer("");
                logMsg (MSSDebug.IMPORTANT, "getResult():" +
String.valueOf(transID));

                // Get the schedule result
                tempStringBuf = new
StringBuffer("select(where(patient_result, tran_id = ");
                tempStringBuf.append(transID).append("), violations,
can_commit, tran_expire_min=tran_expire_tm-now())");
                logMsg (MSSDebug.INFORMATIONAL, "Query:" +
tempStringBuf.toString());
                try {
                        conROS = initialize (marsPort);
                        // first get the header/patient results and check if
schedule was generated
                        ROSCursor =
conROS.createCursor(tempStringBuf.toString());
                        if (ROSCursor.getRowCount() != 1) {
                                logMsg (MSSDebug.ALWAYS, "Mars interface
error: patient_result row count="
                                        +ROSCursor.getRowCount()+" for
transID=" + transID);
                                headerObj.put("errorMessage", "no result
returned from Mars");
                                headerObj.put("errorCode", new Integer(0));
                                disconnectMars(conROS);
                                return false;
                        }
                        ROSCursor.first();
                        rowAttributeList = new Hashtable();
                        tempObj = ROSCursor.getCell ("tran_expire_min");
                        if (tempObj != null) {
                                tempInteger = (Integer) tempObj;
                                headerObj.put ("expireMinutes",
tempInteger);
                                logMsg(MSSDebug.INFORMATIONAL+2,
"tran_expire_min:" + tempInteger.toString());
                        }
                        
                        tempString = (String) ROSCursor.getCell
("violations");
                        logMsg (MSSDebug.INFORMATIONAL+2, "violations:" +
tempString);
                        if (tempString != null) headerObj.put("violation",
tempString);
                        
                        tempObj = ROSCursor.getCell ("can_commit");
                        boolean requestStatus = false;
                        if (tempObj != null) {
                                tempInteger = (Integer) tempObj;
                                requestStatus = tempInteger.intValue() ==
1?true:false;
                                logMsg (MSSDebug.INFORMATIONAL+2,
"can_commit:" + tempInteger);
                        }
                        headerObj.put("schedStatus", new
Boolean(requestStatus));
                        
                        // next get the appointment list generated
                        tempStringBuf = new
StringBuffer("sort(where(order_result, tran_id = ");
                        tempStringBuf.append(transID).append("), report_ts
asc, master_item_int_id ASC, order_item_ext_id asc)");
                        logMsg (MSSDebug.INFORMATIONAL, "Query:" +
tempStringBuf.toString());
                        ROSCursor.drop();
                        
                        ROSCursor =
conROS.createCursor(tempStringBuf.toString());
                        if (ROSCursor.getRowCount() < 1) {
                                headerObj.put("errorMessage", "no result
returned from Mars");
                                headerObj.put("errorCode", new Integer(0));
                                headerObj.put("lastCommand",
tempStringBuf.toString());
                                disconnectMars(conROS);
                                return false;
                        }
                        ROSCursor.first();
                        
                        int orderItemNum;
                        while (true) {
                                try {
                                        // create one schedapptitem for each
line returned. 
                                        // For each appt date/time, create
the sched appointment data to contain
                                        //   all the schedapptitem objects
in the vector list.
                                        rowAttributeList = new
Hashtable(10);
                                        rowAttributeList.put("resultType",
"appt");
                                        tempInteger = (Integer)
ROSCursor.getCell ("order_item_ext_id");
                                        logMsg (MSSDebug.INFORMATIONAL+2,
"order_item_ext_id:" + tempInteger);
                                        rowAttributeList.put("itemExternID",
tempInteger);
        

                                        tempInteger = (Integer)
ROSCursor.getCell ("scheduled");
                                        logMsg (MSSDebug.INFORMATIONAL+2,
"scheduled:" + tempInteger);                                    
                                        boolean itemSchedStatus =
tempInteger.intValue()== 1? true:false;
                                        rowAttributeList.put("schedStatus",
new Boolean (itemSchedStatus)); 
                                        
                                        tempString = (String)
ROSCursor.getCell ("violations");
                                        logMsg (MSSDebug.INFORMATIONAL+2,
"validations:" + tempString);                                   
                                        rowAttributeList.put("violation",
tempString);
                                                                        
                                        // Only if scheduled would it have
values for these fields.  Otherwise,
                                        // these fields would have null
values and thus could cause null pointer exceptions
                                        if (itemSchedStatus) {
                                                logMsg
(MSSDebug.INFORMATIONAL+2, "getting report_ts");
                                                utilDate = (java.util.Date)
ROSCursor.getCell ("report_ts");
                                                logMsg
(MSSDebug.INFORMATIONAL+2, "report_ts:" + utilDate.toString());
                                                // convert java.util.Date to
java.sql.Date
        
rowAttributeList.put("apptDateTime", utilDate);
        
                                                tempObj = ROSCursor.getCell
("rsc_id");
                                                if (tempObj!=null) {
                                                        tempInteger =
(Integer) tempObj;
                                                        logMsg
(MSSDebug.INFORMATIONAL+2, "rsc_id:" + tempInteger);
        
rowAttributeList.put("rscID", new Double(tempInteger.intValue()));
                                                }

                                                tempObj = ROSCursor.getCell
("loc_id");
                                                if (tempObj!=null) {
                                                        tempInteger =
(Integer) tempObj;
                                                        logMsg
(MSSDebug.INFORMATIONAL+2, "loc_id:" + tempInteger);
        
rowAttributeList.put("locID", new Double(tempInteger.intValue()));
                                                }
                                        }
                                        logMsg (MSSDebug.INFORMATIONAL+1,
"checking if appointment object needs to be created");
        
resultObj.addElement(rowAttributeList);
                                        ROSCursor.next();

                                }
                                catch (Exception e) {
                                        logMsg (MSSDebug.ALWAYS, "Mars
interface error:"+ e.getMessage()+" for transID=" + transID);
                                        headerObj.put("errorMessage", "Mars
interface error:"+ e.getMessage()+" for transID=" + transID);
                                        headerObj.put("errorCode", new
Integer(0));
        
resultObj.addElement(rowAttributeList);
                                        return false;
                                }
                                
                                if (!ROSCursor.isValid()) {
                                        logMsg (MSSDebug.INFORMATIONAL+2,
"Break loop of items for transID=" + transID);
                                        break; 
                                }
                        }
                        ROSCursor.drop();
                                                
                        if (requestStatus) {
                                // last get the capacity update list
                                tempStringBuf = new StringBuffer
("where(capacity_result, tran_id = ");
                                tempStringBuf.append(transID).append(")");
                                logMsg (MSSDebug.INFORMATIONAL, "Query:" +
tempStringBuf.toString());

                                ROSCursor =
conROS.createCursor(tempStringBuf.toString());
                                if (ROSCursor.getRowCount() < 1) {
                                        logMsg (MSSDebug.ALWAYS, "Mars
interface error: capacity_result row count="
                                                +ROSCursor.getRowCount()+"
for transID=" + transID);
                                        throw new MSSException
(MSSException.TRANSIENTERROR, "Data integrity error, Mars.capacity_result
not returning rows");
                                }
                                ROSCursor.first();

                                while (true) {

                                        rowAttributeList = new
Hashtable(10);
                                        rowAttributeList.put("resultType",
"capacity");
                                        try {
                                                tempObj = ROSCursor.getCell
("desc_id"); // cal_id
                                                if (tempObj != null) {
                                                        tempInteger =
(Integer) tempObj;
                                                        logMsg
(MSSDebug.INFORMATIONAL+2, "desc_id:" + tempInteger.toString());
        
rowAttributeList.put("calID", new Double(tempInteger.intValue()));
                                                }
        

                                                tempObj = ROSCursor.getCell
("svc_id");
                                                if (tempObj != null) {
                                                        tempInteger =
(Integer) tempObj;
                                                        logMsg
(MSSDebug.INFORMATIONAL+2, "svc_id:" + tempInteger.toString());
        
rowAttributeList.put("svcID", new Double(tempInteger.intValue()));
                                                }
        

                                                utilDate = (java.util.Date)
ROSCursor.getCell ("start_ts");
                                                logMsg
(MSSDebug.INFORMATIONAL+2, "start_ts:" + utilDate);
                                                if (utilDate != null)
rowAttributeList.put("startDateTime", utilDate);
                                                
                                                tempObj = ROSCursor.getCell
("used");
                                                if (tempObj != null) {
                                                        tempInteger =
(Integer) tempObj;
                                                        logMsg
(MSSDebug.INFORMATIONAL+2, "used:" + tempInteger);
        
rowAttributeList.put("qtyUsed", tempInteger);
                                                }
                                                
        
resultObj.addElement(rowAttributeList);
                                                
                                                ROSCursor.next();
                                        }
                                        catch (Exception e) {
                                                e.printStackTrace();
                                                logMsg (MSSDebug.ALWAYS,
"Mars interface error:"+ e.getMessage()+" for transID=" + transID);
                                                headerObj.put("errorCode",
new Integer(0));
        
headerObj.put("errorMessage", "Mars interface error:"+ e.getMessage()+" for
transID=" + transID);
        
resultObj.addElement(rowAttributeList);
                                                break;
                                        }
                                        if (!ROSCursor.isValid()) {
                                                logMsg
(MSSDebug.INFORMATIONAL+2, "Break loop of items for transID=" + transID);
                                                break; 
                                        }
                                } // while (capacity retrieve
                                ROSCursor.drop();
                        }
                }
                catch(FWException e) { 
                        logMsg (MSSDebug.ALWAYS, "Mars exception: type=" +
e.getType()
                                        + "/ code=" + e.getCode() + "/Msg="
+ e.getMessage()); 
                        headerObj.put("lastCommand",
tempStringBuf.toString());
                        headerObj.put("errorMessage", "Mars error at command
" + tempStringBuf.toString()
                                        + ": " + e.getMessage());
                        headerObj.put("errorCode", new
Integer(e.getCode()));
                        disconnectMars(conROS);
                        return false;
                }
                catch(Exception e) { 
                        logMsg (MSSDebug.ALWAYS, "Other exception, Msg=" +
e.getMessage()); 
                        headerObj.put("lastCommand",
tempStringBuf.toString());
                        headerObj.put("errorCode", new Integer(0));
                        headerObj.put("errorMessage",
tempStringBuf.toString() + ": " + e.getMessage());
                        disconnectMars(conROS);
                        return false;
                }
                return true;
        }
        

                
                
        /**
         * initializes the ROS connection, reconnect if necessary. If mars
port # 
         *   supplied is different from the current mars port, it will
switch the port
         *   and reconnect.
         * @param marsPort_p desired mars port
         * @return a ROS connection object
com.i2.rv.framework.ros.ocl.Connection
         * @exception FWException if errors
         */
        protected Connection initialize (int marsPort_p) throws FWException
{
                // Connect to ROS if not yet connected.  Connection will be
kept till client
                //   session terminated.
                Connection conROS = null;
                logMsg (MSSDebug.IMPORTANT, "Connecting to Mars with
host/port=" + marsHost + "/" + String.valueOf(marsPort_p));
                conROS = new Connection(marsHost, marsPort);
                conROS.connect();
                return conROS;
        }
        

        protected void finalize () {
                logMsg (MSSDebug.ALWAYS, "finalize: " + serverName + " is
saying good bye.");
                return;
        }

        
        /**
         * Runs any MARS command passed in in the param list.
         * @param runOnControlPort_p if commands are to be run on the
control port
         * @param commandList_p vector of commands
         * @return Vector of Strings containing the results returned from
ROS
         */
        public java.util.Vector runMarsCommand (boolean runOnControlPort_p,
java.util.Vector commandList_p) {
                String ROSReturnString;
                Connection conROS = null;
                IROSEvaluator ROSEvaluator;
                Object marsReturnObj;
                java.util.Vector returnVector = new java.util.Vector();
                if (commandList_p==null || commandList_p.size()<=0) return
returnVector;
                logMsg (MSSDebug.INFORMATIONAL, "runMarsCommand:" +
commandList_p.toString());
                try {
                        if (runOnControlPort_p) conROS =
initialize(marsControlPort);
                        else conROS = initialize(marsPort);
                        ROSEvaluator = (IROSEvaluator)
conROS.createEvaluator();
                }
                catch(FWException e) { 
                        logMsg (MSSDebug.ALWAYS, "MARS exception: type=" +
e.getType()
                                        + "/ code=" + e.getCode() + "/Msg="
+ e.getMessage()); 
                        returnVector.addElement(String.valueOf(e.getCode())
+ ": " + e.getMessage());
                        return returnVector;
                }
                
                for (int i=0; i<commandList_p.size(); i++) {
                        String marsCmd = (String)
commandList_p.elementAt(i);
                        try {
                                logMsg (MSSDebug.INFORMATIONAL, marsCmd);
                                marsReturnObj = ROSEvaluator.expression
(marsCmd);
                                if (marsReturnObj!=null)
returnVector.addElement(marsReturnObj.toString());
                                else returnVector.addElement("NULL");
                        }
                        catch(FWException e) { 
                                logMsg (MSSDebug.ALWAYS, "MARS exception:
type=" + e.getType()
                                                + "/ code=" + e.getCode() +
"/Msg=" + e.getMessage()); 
        
returnVector.addElement(String.valueOf(e.getCode()) + ": " +
e.getMessage());
                        }
                        catch (Exception e) {
                                logMsg (MSSDebug.ALWAYS, "MARS command:" +
marsCmd + " failed with non-MARS error:" 
                                        + e.getMessage());
                                returnVector.addElement("0: " +
e.getMessage());
                        }
                } // for (int i ...
                disconnectMars(conROS);
                return returnVector;
        }
        
        /**
         * disconnect from Mars, ignore any exceptions
         */
        protected void disconnectMars(Connection conROS_p) {
                try {conROS_p.disconnect();}            
                catch(FWException e) { 
                        logMsg (MSSDebug.ALWAYS, "MARS exception: type=" +
e.getType()
                                        + "/ code=" + e.getCode() + "/Msg="
+ e.getMessage()); 
                }
                return;
        }       


        public String deleteOrderSet(String transID, String actionCode) {
                Connection conROS = null;
                IROSEvaluator ROSEvaluator;
                logMsg (MSSDebug.IMPORTANT, "deleteOrderSet:" + transID +
"/" + actionCode);
                if (actionCode==null || actionCode.equals("")) actionCode =
"rollback";
                StringBuffer tempStringBuf = new
StringBuffer("delete_order_set (");
                try {
        
tempStringBuf.append(transID).append(",|").append(actionCode).append("|)");
                        conROS = initialize(marsPort);
                        ROSEvaluator = (IROSEvaluator)
conROS.createEvaluator();
                        logMsg (MSSDebug.IMPORTANT,
tempStringBuf.toString());
                        ROSEvaluator.expression (tempStringBuf.toString());
                        disconnectMars(conROS);
                }
                catch(FWException e) { 
                        logMsg (MSSDebug.ALWAYS, "Mars exception: type=" +
e.getType()
                                        + "/ code=" + e.getCode() + "/Msg="
+ e.getMessage()); 
                        disconnectMars(conROS);
                        return String.valueOf(e.getCode()) + ": " +
e.getMessage();
                }
                catch(Exception e) { 
                        logMsg (MSSDebug.ALWAYS, "Other exception, Msg=" +
e.getMessage()); 
                        disconnectMars(conROS);
                        return "0: " + e.getMessage();
                }
                return "1";
        }

        public String deleteOrderSet(String userID, double mcNum) {     
                Connection conROS = null;
                IROSEvaluator ROSEvaluator;
                String ROSReturnString, myExpression = "";
                logMsg (MSSDebug.IMPORTANT, "deleteOrderSet:" +
userID+"/"+String.valueOf(mcNum));
                StringBuffer tempStringBuf = new
StringBuffer("delete_order_set (");
                try {
        
tempStringBuf.append("\"").append(userID).append("\",").append((new
Double(mcNum)).longValue()).append(")");
                        logMsg (MSSDebug.INFORMATIONAL,
tempStringBuf.toString());
                        conROS = initialize(marsPort);
                        ROSEvaluator = (IROSEvaluator)
conROS.createEvaluator();
                        ROSEvaluator.expression (tempStringBuf.toString());
                        disconnectMars(conROS);
                }
                catch(FWException e) { 
                        logMsg (MSSDebug.ALWAYS, "Mars exception: type=" +
e.getType()
                                        + "/ code=" + e.getCode() + "/Msg="
+ e.getMessage()); 
                        disconnectMars(conROS);
                        return String.valueOf(e.getCode()) + ": " +
e.getMessage();
                }
                catch(Exception e) { 
                        logMsg (MSSDebug.ALWAYS, "Other exception, Msg=" +
e.getMessage()); 
                        disconnectMars(conROS);
                        return "0: " + e.getMessage();
                }
                return "1";
        }        
}


> -----Original Message-----
> From: Paul Libbrecht [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, March 19, 2002 5:52 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: connection refused error
> 
> The socket exception (on the client-side I presume) is normal...
> It just says the server did not answer anything and has shut-down the 
> connection before doing so which is wrong in the HTTP protocol. But that 
> test is meant not to answer anything, we want to know about the client, 
> not the server, right ??
> 
> The fact that it should hang the server is not normal however.
> Another connection (at worst a telnet) should still hook-off and listen.
> But that DumbServer only listens.
> 
> Paul
> 
> 
> On Mardi, mars 19, 2002, at 08:33 , Lin, Yaxiong wrote:
> 
> >
> > Paul:
> >
> > When I ran the same xmlrpc.jar on NT, I got the same output on 
> > webserver as
> > yours.
> >
> > Also I am getting the socket exception on client (NT again) which 
> > causes the
> > webserver to refuse any new connection.  The exception is:
> > java.net.SocketException: Connection reset by peer: JVM_recv in socket 
> > input
> > stream read.
> >
> > I am using the XmlRpcClientLite in this case.
> >
> > What could have caused this SocketException and how to avoid this 
> > problem?
> >
> > Thanks.
> >
> > - Yaxiong
> >
> >
> >> -----Original Message-----
> >> From:      Paul Libbrecht [SMTP:[EMAIL PROTECTED]]
> >> Sent:      Tuesday, March 19, 2002 2:17 AM
> >> To:        [EMAIL PROTECTED]
> >> Subject:   Re: connection refused error
> >>
> >> Yaxiong,
> >>
> >> I finally made the test with XmlRpcClientLite (thanks to BeanShell)
> >> and... I get a completely different one:
> >>
> >>> Accepted connection.
> >>> POST /aPath HTTP/1.0
> >>> User-Agent: Apache XML-RPC 1.0
> >>> Host: localhost:1037
> >>> Content-Type: text/xml
> >>> Content-Length: 95
> >>
> >>
> >> This makes me believe that your jar may be corrupted...
> >> Have you tried downloading another one ??
> >>
> >> Paul
> >>
> >>
> >> On Lundi, mars 18, 2002, at 11:20 , Lin, Yaxiong wrote:
> >>
> >>>
> >>> Paul:
> >>>
> >>> Thanks for much for giving the code as well to do my debugging!!!
> >>>
> >>> I don't know how to interpret the output as they are drastically
> >>> different.
> >>> The first set of the output was sent by XmlRpcClientLite and the 
> >>> second
> >>> set
> >>> was sent by the XmlRpcClient.
> >>>
> >>> It looks like the packet sent by XmlRpcClientLite does not have the
> >>> header!
> >>>
> >>> Thanks.
> >>>
> >>> - Yaxiong
> >

Reply via email to