2 Replies Latest reply on Dec 21, 2009 12:42 PM by nimmagadda_k

    Need help in Delete operation using blazeDS

    nimmagadda_k

      Please find the flex client code and servlet code given below

      Trying to call a DELETE methods on the servlet using BlazeDS.Configuration is perfect in the proxy-config.xml and services-config.xml

      when DELETE is called with paramter user="krishna it is being printed as


      received DELETE operation with parameternull   

       

       

      My Question is why the servlet printing null value for the user where it should print "someuser"?Can some one help me on this?

       

      ---------------------------------------------------

      FLEX CLIENT

      -------------------------------------------------------

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

       

      xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

      <mx:Script>

      <![CDATA[

       

       

      import mx.controls.Alert;

       

      import mx.rpc.http.HTTPService;

       

      import mx.rpc.events.ResultEvent;

       

      import mx.rpc.events.FaultEvent;

       

      public function callServletDELETE():void {

       

       

      var service:HTTPService = new HTTPService();

       

      //service.url= "http://localhost:8080/examples/blazeDS";

      service.destination=

      "BlazeDSHTTP"; //this is configured in proxy-config.xml file

      service.useProxy =

      true;

      service.method =

      "DELETE";

      service.resultFormat=

      "e4x";

      service.addEventListener(

      "result", billingCarrierResult);

      service.addEventListener(

      "fault", httpFault);

      service.send({user:

      'someuser'});

      }

       

      protected function billingCarrierResult(event:ResultEvent):void

      {

      serviceResultsTextArea.text =

       

      "Success with BlazeDS!\n"+event.result;

       

      }

       

       

      protected function httpFault(event:FaultEvent):void

      {

      serviceResultsTextArea.text =

       

      "Failure trying to access service.\n"+ event.fault.faultString + "\n" + event.fault.faultDetail;

      }

       

      ]]>

      </mx:Script>

       

      <mx:TextArea

       

      id="serviceResultsTextArea" width="50%" height="50%" />

      <mx:Button

       

      label="DELETE" click="callServletDELETE()"/>

      </mx:Application>

       

       

       

       

      ----------------------------------------------

      servlet

      ----------------------------------------------

       

      import java.io.*;

      import javax.servlet.*;
      import javax.servlet.http.*;

      /**
      * Simple example intended to demonstrate BlazeDS with HttpService.
      */
      public class BlazeHttpExample extends HttpServlet
      {

         //excluded other methods GET,POST as they are working fine

         /**
          * Handles the HTTP <code>DELETE</code> method.
          * @param request servlet request
          * @param response servlet response
          */
         @Override
         protected void doDelete(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
         {
            System.out.println("received DELETE operation with parameter"+request.getParameter("user"));
         }

         @Override
         public String getServletInfo()
         {
            return "Simple intended to illustrate BlazeDS HttpService support.";
         }
      }