0 Replies Latest reply on Aug 19, 2009 9:18 AM by krishna kumar

    Request Parameters passed thru URL Connection lost while co

    krishna kumar Newbie

      Issue : Request Parameters passed thru URL Connection lost while communicating between two web apps of JBoss 4.2GA

      Environment:
      We have JBoss4.2 installed on Solaris10 machine. And our J2EE based application has one ear file and an external war file.
      so, effectively, we will see di.ear and idsmu.war files present in jboss\server\all\deploy folder.

      Scenario:
      Note that di.ear is an application in itself and has its own war file residing inside it.
      And idsmu.war file is a saperate application/module that is accessible from di.ear application UI.

      The communication between idsmu.war file and di.ear file is by using url request/response.

      Let's say idsmu.war application finished its work and wants to communicate to di.ear application, then the url
      http://:7799/di/common/MU.do?userid=im_owner&password=*****&Job=start is fired, invoking other application.

      Pojo object1(RushRequest.java) in web application IDS-MU , access the HTTP url using URLConnection of di.The specific action class (MUAction.java) in di application,access the parameters and based on that invokes the ejb call.
      Sample Code:
      Sample Code in RushRequest.java which exist in IDSMU.war which inittiates the request and expects the response back:
      try {
      sURLReq = sUrl + saParam[actionIndex];
      sURLReqOut = sUrlOut + saParam[actionIndex];
      Log.out("Sending request to " + sURLReqOut, 'I');
      URL url = new URL(sURLReq);
      URLConnection con = url.openConnection();
      InputStream ips = con.getInputStream();
      ObjectInputStream oips = new ObjectInputStream( ips );
      Hashtable ahashtable = (Hashtable)oips.readObject();
      oips.close();
      String sResp = (String) ahashtable.get("StartOrStop");
      Log.out("Request returned " + sResp, 'I');
      if (sResp != null && sResp.equals(saValue[actionIndex]) )
      bRC = true;
      } catch( Exception e ) {
      Log.out("Error Sending request to " + sURLReqOut, 'E');
      }
      Once MUAction.java which exist in di.war file,get the request it process the request and finally creates the response back thro output stream:
      Sample Code in MUAction.java which exist in di.war which process the request and populate the response back:
      class MUAction extends DynamicAction {
      ...
      ublic ActionForward perform(ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws IOException, ServletException {
      String job = request.getParameter("Job");
      undoJob = request.getParameter("UndoJob");
      ..
      ServletOutputStream sos = response.getOutputStream();
      ous = new ObjectOutputStream( (OutputStream)sos );
      ous.writeObject(ahash );
      ous.writeObject(stoppedJobIds);
      ..

      URLConnection Problem:
      Even though we are passing the the parameters when invoking the URL request thru URLCOnnection,the action class of another wep application not getting the parameter values.As well as the reuesting class throws/log the custom message "Error Sending request to " because the response not got for the corresponding request.
      This issue occurs only one environment of solaris/jboss4.2.

      How to resolve the issue to get the passed parameters in the action class??