Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RestDataSource queuing broken in 8.2?

    Version: SmartClient 8.2

    Is the transaction queuing broken in 8.2? (nightly build as of 2011-01-10)

    If I set "disableQueuing: true" then I get two POST's sent to the server as expected on a multi component drop add operation. But if I let the system attempt to queue the POST request to the server then I get the following sent to the server:

    Code:
    { transaction: { transactionNum: 70, operations: [null, null]}}
    The system recognizes that it is supposed to be sending two operations to the server, but the operation data is missing.

    The only change that I make between the working version and the failing version is setting disableQueuing:true/false.

    When set to true the POST includes all the necessary data.
    When set to false the POST is missing all the necessary data.

    I have tried with dataFormat:"xml" and dataFormat:"json" with the same results.

    I have also tried dataProtocol:'postParams' and dataProtocol: 'postMessage' with the same result.

    I assume there is some other piece that I am missing to get this to work properly. Any pointers on what I'm missing would be greatly appreciated.

    Thanks,
    Chris

    #2
    Can you show a test case we can use to reproduce this problem?

    Comment


      #3
      Here is a simple example.

      The example.js file:
      Code:
      isc.RestDataSource.create({
        ID:"dataSource0",
        dataURL: "http://localhost:3000/ds0",
        dataFormat:"json",
        fields:{
          id:{
            name:"id",
            primaryKey:true,
            required:true,
            title:"ID",
            type:"integer"
          },
          name:{
            length:255,
            name:"name",
            required:true,
            title:"Name",
            type:"text"
          }
        }
      });
      
      isc.RestDataSource.create({
        ID:"dataSource1",
        dataURL: "http://localhost:3000/ds1",
        dataFormat:"json",
        disableQueuing: false,
        fields:{
          id:{
            name:"id",
            primaryKey:true,
            required:true,
            title:"ID",
            type:"integer"
          },
          name:{
            length:255,
            name:"name",
            required:true,
            title:"Name",
            type:"text"
          }
        }
      });
      
      isc.ListGrid.create({
        ID:"ListGrid0",
        autoDraw:false,
        dataSource:"ref:dataSource0",
        autoFetchData: true,
        fields:[
        {
          name:"id",
          title:"ID"
        },
        {
          name:"name",
          title:"Name"
        }
        ],
        listEndEditAction:"next",
        showFilterEditor:false,
        canEdit:true,
        canDragRecordsOut:true,
        dragDataAction:"copy",
        canRemoveRecords:true,
        "xsi:type":"ListGrid" 
      });
      
      isc.ListGrid.create({
        ID:"ListGrid1",
        autoDraw:false,
        dataSource:"ref:dataSource1",
        fields:[
        {
          name:"id",
          title:"ID"
        },
        {
          name:"name",
          title:"Name"
        }
        ],
        listEndEditAction:"next",
        showFilterEditor:false,
        canEdit:true,
        canDragRecordsOut:false,
        canAcceptDroppedRecords:true,
        canReorderRecords:true,
        canRemoveRecords:true,
        "xsi:type":"ListGrid"
      });
      
      isc.HLayout.create({
        ID:"HLayout0",
        autoDraw:false,
        members:[
        ListGrid0,
        ListGrid1
        ]
      });
      
      isc.DataView.create({
        ID:"DataView0",
        autoDraw:true,
        overflow:"hidden",
        members:[
        HLayout0
        ],
        width:"100%",
        height:"100%"
      });
      The test server code (Runs under node.js with the Express framework):
      http://nodejs.org/
      http://expressjs.com/

      Code:
      var express = require("express");
      var app = express.createServer();
      var dataSource0_response = {
        response: {
          data: [
            {id: 1, name: 'John Doe'},
            {id: 2, name: 'Jack T Ripper'},
            {id: 3, name: 'Clark Kent'},
            {id: 4, name: 'Peter Parker'},
            {id: 5, name: 'Bruce Banner'}
          ],
          status: 0
        }
      };
      app.configure(function() {
        app.use(express.bodyParser());
        app.use(express.methodOverride());
        return app.use(express.static(__dirname + "/public"));
      });
      app.get('/ds0', function(req, res){
          res.send(dataSource0_response);
      });
      
      app.post('/ds1', function(req, res){
        console.log(req);
        res.send({response:{status: 0, data: [{id:1, name: 'junk'}]}});
      });
      template = '<html><head>' +
      '<script src="/isomorphic/system/modules/ISC_Core.js" ></script>' + 
      '<script src="/isomorphic/system/modules/ISC_Foundation.js" ></script>' + 
      '<script src="/isomorphic/system/modules/ISC_Containers.js" ></script>' + 
      '<script src="/isomorphic/system/modules/ISC_Grids.js" ></script>' + 
      '<script src="/isomorphic/system/modules/ISC_DataBinding.js" ></script>' + 
      '<script src="/isomorphic/skins/Enterprise/load_skin.js" ></script>' + 
      
      '</head><body>' +
      '<script src="/example.js" ></script>' + 
      '<script type="text/javascript">' + 
      'window.isomorphicDir="/isomorphic";' +
      '</script></body></html>';
      
      app.get('/', function(req, res){
        res.send(template)
      })
      app.listen(3000);
      NOTE: The response from the server from a drop is simply:
      Code:
      {response:{status: 0, data: [{id:1, name: 'junk'}]}}
      and it is not designed to handle the transaction either. This is intentional in order to limit the scope of the example.

      Use Firebug or the Chrome/Safari developer tools to examine the data that is sent to the server.

      When disableQueuing is set to true everything works as expected, but when set to false the actual record data is not sent to the server.

      Thanks again,
      Chris

      Comment


        #4
        I almost forgot the basic instructions. Select at least two records in the left grid, and then drag and drop them into the right grid.

        Comment


          #5
          I am having exact the same issue, using Smart GWT 3.0 and 3.0 p.

          Smart GWT 2.5 does send some incorrect formatted data on sendQueue.

          Comment


            #6
            When I specify the operationbindings on the datasource, queuing functions.

            Comment


              #7
              Originally posted by reaper
              I have also tried dataProtocol:'postParams' and dataProtocol: 'postMessage' with the same result.
              You need to specify dataProtocol: 'postMessage' in dataSource.operationBindings

              Comment


                #8
                Originally posted by pszturmaj
                You need to specify dataProtocol: 'postMessage' in dataSource.operationBindings
                I probably should have been more specific. This is what my operationalBindings looks like.

                Code:
                operationBindings:[
                     {operationType:"fetch", dataProtocol:"getParams"}
                     {operationType:"add", dataProtocol:"postParams"}
                     {operationType:"remove", dataProtocol:"postParams", requestProperties:{httpMethod:"DELETE"}}
                     {operationType:"update", dataProtocol:"postParams", requestProperties:{httpMethod:"PUT"}}
                  ]
                and I have tried with the dataProtocol section converted to 'postMessage' too.

                Although it may have a problem because no matter what I put in there the 'remove' parameters are being sent as 'getParams' for some weird reason.

                Comment


                  #9
                  You marked 'remove' as HTTP DELETE method. You need to remove request properties from operation binding. Transactions works only if requests use 'postMessage' and json or xml format.

                  Here is my code that currently works (previously I had the same problem with null transactions).

                  Code:
                  var opBindings = [
                      { operationType: 'fetch' , dataProtocol: 'postMessage' },
                      { operationType: 'add'   , dataProtocol: 'postMessage' },
                      { operationType: 'remove', dataProtocol: 'postMessage' },
                      { operationType: 'update', dataProtocol: 'postMessage' }
                  ];
                  
                  isc.RestDataSource.create({
                      ID: 'ds1',
                      dataURL: 'controller2.php',
                      dataFormat: 'json',
                      operationBindings : opBindings,
                      fields: [
                          { name: 'id' },
                          { name: 'name' }
                      ],
                      cacheAllData: true
                  });
                  
                  isc.RestDataSource.create({
                      ID: 'ds2',
                      dataURL: 'controller2.php',
                      dataFormat: 'json',
                      operationBindings : opBindings,
                      fields: dataFields,
                      jsonPrefix: '',
                      jsonSuffix: '',
                      requestProperties: { params: { id: 5 } },
                      cacheAllData: true
                  });
                  Here, two fetches are joined into single transaction. requestProperties are appended to URL, so it becomes controller2.php?id=5. Also, make sure that dataURL's are the same.

                  And don't forget about jsonPrefix/Suffix, because currently RPC manager doesn't handle responses if you leave these unspecified.

                  Comment


                    #10
                    I am trying to run the example above to deploy a SmartClient application with Node.js. The application starts with no errors, but when I navigate to the localhost:3000 I get blank screen. And when I select “View page source” and select any of the JavaScript files the message is:

                    Cannot GET /SmartClient_82_LGPL/smartclientSDKisomorphic/system/modules/ISC_Core.js
                    Was anyone able to deploy SmartClient app with Node.js? Can you provide a code sample?

                    Node: v0.6.13
                    SmartClient: SmartClient_82_LGPL
                    FireFox: 11.0

                    Comment


                      #11
                      It looks to me like you just left out a slash in the URL. Your error message is saying:
                      /SmartClient_82_LGPL/smartclientSDKisomorphic/system/modules/ISC_Core.js

                      It should probably say:
                      /SmartClient_82_LGPL/smartclientSDK/isomorphic/system/modules/ISC_Core.js

                      I'm guessing you just have a typo in your url.

                      Comment


                        #12
                        I have the same problem with 8.2

                        update a restdatasource with queue is broken no update data sended to server and some data is passed via url query string while i using postParams.

                        In 8.1 this feature is working

                        Comment

                        Working...
                        X