2 Replies Latest reply on Jan 30, 2007 1:56 AM by kapil.singhal

    Exception handling in Bulk calls

    kapil.singhal

      Hello,

      I am using JBoss 4.0.05GA and JBossWS 1.0.3.

      I have created a Web Service and I am exposing various methods at the client-end. I have provided custimozed SOAP API Exception to be thrown at the client-end in the form of code, actor, text etc. When ever any method/call is failed, an excpetion is raised.

      But if a call is returning 100 values in one method (bulk call) and an exception is being raised when 90 values have been returned to the client, then how to handle the exception as I want that 90 values fetched should be returned to the client. Since in a normal scenario the values fetched does not get retained at the client-end till the method is not executed completely.

      I want to retain those values which were fetched before the exception has been raised.

      For e.g: The method is getting the 100 names from a database and after 90 names have been fetched, some problem occurs on the database server. The client will receive the exception as "Internal Error has occurred", but it should also get the 90 values fetched from the server.

      Any help will be appreciated.

      Kindly suggest.

      Thanks & Regards,
      Kapil

        • 1. Re: Exception handling in Bulk calls

          Please post your code along with the query.

          • 2. Re: Exception handling in Bulk calls
            kapil.singhal

            Hello,

            The following code snippet is getting Displet color detail in a single call based on Object Id. The second method getDipletColorDetails() is calling the above method getDispletColorDetail() in a for() loop for the no. of iterations. Now if there are 100 iterations and an exception is being raised after 50 iterations due to some error, what about the result of 50 iterations as I have already called the single(first) method 50 times. I want to store and return the result of the executed calls to the client before the exception is being raised.

            @WebMethod
             public DispletColorDetail getDispletColorDetail (int aSessionId, ObjectId aDispletId)
             {
             mLogger.debug("SessionId: ", aSessionId, "; getDispletColorDetail - DispletId: ", aDispletId);
            
             SessionObject session = validateSession(aSessionId, "getDispletColorDetail");
             validateNotNull(aDispletId, "getDispletColorDetail",
             "Please provide a valid Object id of a Displet, required for getting the DispletColorDetail.");
            
             Displet displet = demarshallDisplet(aDispletId);
            
             DispletColorDetail result = null;
             try
             {
             result = marshallColorDetail(displet);
             }
             catch (Exception e)
             {
             throwInternalError("getDispletColorDetail", e,
             "Unexpected error occurred while getting Displet Color Detail. Please contact Barco Customer Support.", "SessionId", aSessionId,
             "ObjectId", aDispletId);
             }
            
             mLogger.debug("Session: ", session, "; getDispletColorDetail returned, result: ", result);
             return result;
             }
            
            
             @WebMethod
             public DispletColorDetail[] getDispletColorDetails (int aSessionId, ObjectId[] aDispletIdList)
             {
             mLogger.debug("SessionId: ", aSessionId, "; getDispletColorDetails - DispletIdList: ", aDispletIdList);
            
             SessionObject session = validateSession(aSessionId, "getDispletColorDetails");
             validateNotNull(aDispletIdList, "getDispletColorDetails",
             "Please provide a valid ObjectId list of Displets, required for getting the corresponding DispletColorDetails.");
            
             DispletColorDetail[] result = new DispletColorDetail[aDispletIdList.length];
             for (int i = 0; i < aDispletIdList.length; i++)
             {
             result = getDispletColorDetail(aSessionId, aDispletIdList);
             }
            
             mLogger.debug("Session: ", session, "; getDispletColorDetails returned, result: ", result);
             return result;
             }
            


            I hope I am able to clear the problem.

            Please suggest.