Announcement

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

    My SmartGWT 4.1 client cannot invoke Spring server's bean

    hello expectises

    I use SmartGWT 4.1 in client side, DMI and send the DSRequest to server for DB fetching and updating. In server side, I integrate SmartGWT to Spring Core 3.2.4-RELEASE

    And the web.xml is as following
    Code:
        <!-- standard spring configuration -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/applicationContext.xml</param-value>
        </context-param>
     
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>  
    
       <listener>
             <listener-class>com.isomorphic.base.InitListener</listener-class>
         </listener>
    
        <servlet>
            <servlet-name>IDACall</servlet-name>
            <servlet-class>com.isomorphic.servlet.IDACall</servlet-class>
        </servlet>
    
        <servlet>
            <servlet-name>DataSourceLoader</servlet-name>
            <servlet-class>com.isomorphic.servlet.DataSourceLoader</servlet-class>
        </servlet>
    
        <servlet>
            <servlet-name>Init</servlet-name>
            <servlet-class>com.isomorphic.base.Init</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
          
        <servlet>
            <servlet-name>HttpProxy</servlet-name>
            <servlet-class>com.isomorphic.servlet.HttpProxyServlet</servlet-class>
        </servlet>
    
        <!-- RPCManager uses this URL by default for Built-in DataSource operations -->
        <servlet-mapping>
            <servlet-name>IDACall</servlet-name>
            <url-pattern>/showcase/sc/IDACall/*</url-pattern>
        </servlet-mapping>
    
        <!-- Built-in DataSource operations backcompat -->
        <servlet-mapping>
            <servlet-name>IDACall</servlet-name>
            <url-pattern>/showcase/sc/IDACall.aspx/*</url-pattern>
        </servlet-mapping>
    
        <!-- DataSourceLoader requests -->
        <servlet-mapping>
            <servlet-name>DataSourceLoader</servlet-name>
            <url-pattern>/showcase/sc/DataSourceLoader</url-pattern>
        </servlet-mapping>
    
        <servlet-mapping>
            <servlet-name>HttpProxy</servlet-name>
            <url-pattern>/showcase/sc/HttpProxy/*</url-pattern>
        </servlet-mapping>
    
        <!-- serve ISC modules compressed, with expires headers -->
        <servlet-mapping>
            <servlet-name>FileDownload</servlet-name>
            <url-pattern>/showcase/sc/system/modules/*</url-pattern>
        </servlet-mapping>
    
        <!-- General config -->
        <session-config>
            <session-timeout>30</session-timeout>
        </session-config>
    
        <jsp-config>
            <!-- Isomorphic JSP tags -->
            <taglib>
                <taglib-uri>isomorphic</taglib-uri> 
                <taglib-location>/WEB-INF/iscTaglib.xml</taglib-location> 
            </taglib>
        </jsp-config>
    
    	<!-- Default page to serve -->
    	<welcome-file-list>
    		<welcome-file>ShowCase.html</welcome-file>
    	</welcome-file-list>
    and define the DataSource XML in client side as following

    Code:
    <DataSource
        ID="Account"
        serverType="generic">
    
        <fields>
            <field name="accountNo" type="text" title="Account No." length="6" required="true" primaryKey="true"/>
            <field name="accountType" type="text" title="Account Type" length="25" required="true">
                <valueMap>
                    <value ID="I">Individual</value>
                    <value ID="C">Corporate</value>
                </valueMap>
            </field>
            <field name="firstName" type="text" title="First Name" length="100" required="true"/>
            <field name="lastName" type="text" title="Last Name" length="40"/>
        </fields>
    
        <serverObject lookupStyle="spring" bean="accountServer"/>    
    </DataSource>
    I checked that it can call the showcase/sc/DataSourceLoader (by SC.say())

    But I cannot found it proceed to server Spring Bean, even no error in server log... Seem it cannot invoke the server side, after accessing the DataSource in client side. Hence I want to ask where can I put log ( in client or server side also,) to check the outgoing of DSRequest and reponse stream DSResponse?

    What's the internal step in SmartGWT when we submit form and the DS Request is generated in client side?

    #2
    Take a look in the developer console, SC.showConsole() - in particular, examine the RPC and Server Logs tabs.

    Comment


      #3
      Firstly, Thx you advice on using SC.showConsole() and I found this very helpful

      And for my testing, I have a Spring bean call accountServer that help to get the account data list and return as DSResponse

      And I can see my submit in RPC tab as following
      Code:
      URL: ds/Account.ds.xml
      Type: DSRequest
      DS: Account
      Operation: fetch
      Component: iscAccountDataListGrid_0
      Status: SUCCESS
      I found there is a Raw Response in RPC tab as following
      Code:
      <DataSource
          ID="Account"
          serverType="generic"
          autoDeriveSchema="true">
      
          <fields>
              <field name="accountNo" type="text" title="Account No." length="6" required="true" primaryKey="true"/>
              <field name="accountType" type="text" title="Account Type" length="25" required="true">
                  <valueMap>
                      <value ID="I">Individual</value>
                      <value ID="C">Corporate</value>
                  </valueMap>
              </field>
              <field name="firstName" type="text" title="First Name" length="100" required="true"/>
              <field name="lastName" type="text" title="Last Name" length="40"/>
          </fields>
      
          <serverObject lookupStyle="spring" bean="accountServer"/>    
      </DataSource>
      And double check that there is no any log in server from accountServer Spring bean (seem cannot reach

      I want to ask, if I can see the status of DSRequest = SUCCESS, and what's the next steps that that I can trace?
      Is it a expected flow that we call the 'ds/Account.ds.xml' and what's the next step in DMI?

      Comment


        #4
        You appear to be just loading the Account.ds.xml file directly? DataSources are loaded by the DataSourceLoader servlet. Just loading the XML file directly won't load the DataSource correctly, and won't produce a server log because the DataSourceLoader servlet isn't involved.

        It looks as if you are diving in and just copying and pasting bits of samples. Before you proceed any further, please read the QuickStart Guide.

        Comment


          #5
          thx your advice and I try same xml config and same code but only change the smartgwt version from 4.1 to 3.1

          And I found this work, and the DSRequest info in showConsole() RPC tab is different for URL

          Code:
          URL: http://localhost:8080/testapp/showcase/sc/IDACall
          ...
          I want to use SmartGWT 4.1 as it have some new feature that I found very good for my use case.
          But do you know where can I config the URL correctly so that it can call IDACall and get the result?

          Following is the code that I test the LiveGrid function
          Code:
          		setSize("100%", "100%");
          		final VLayout layoutContent = new VLayout();
          		layoutContent.setSize("100%", "100%");
          		
          		final DynamicForm dynamicForm = new DynamicForm();
          		dynamicForm.setWidth("100%");
          		dynamicForm.setItemLayout(FormLayoutType.ABSOLUTE);
          				
          		final ListGrid listGrid = new ListGrid();
          		
          		final ListGridField accountNoField = new ListGridField("accountNo");
          		final ListGridField accountTypeField = new ListGridField("accountType");
          		final ListGridField firstNameField = new ListGridField("firstName");
          		final ListGridField lastNameField = new ListGridField("lastName");
          
            		listGrid.setFields (
            				accountNoField,
            				accountTypeField,
            				firstNameField,
            				lastNameField
            				);
             		
            		AccountPagingRestDS ds = AccountPagingRestDS.getInstance();
            		listGrid.setShowAllRecords(false);
            		listGrid.setDataSource(ds);
            		listGrid.setDataPageSize(100);
            		listGrid.setAutoFetchData(true);
          
          		CanvasItem listGridCanvasItem = new CanvasItem();
          		listGridCanvasItem.setCanvas(listGrid);
          		listGridCanvasItem.setHeight(250);
          		listGridCanvasItem.setWidth(1000);
          		
          		dynamicForm.setFields(listGridCanvasItem);
          		layoutContent.addMember(dynamicForm);
          		addMember(layoutContent);
          Last edited by ttuunngg@gmail.com; 7 Jan 2014, 20:06.

          Comment


            #6
            hi expertise,

            I have to try the sample in SmartGWT 4.1 sample 'hibernate-spring-dmi' and found the RPC traffic is correct

            But when I compare web.xml, and ShowCase.ds.xml of my existing testing project, I cannot found any different.

            Can I know which config I can check if for case that the DSRequest URL from client to server become wrong, is there any config control this? or some library conflict that would cause this happen?

            Best Request

            Comment


              #7
              I fix this by recreating the project based on sample project bundled in SmartGWT download
              thx

              Comment


                #8
                Further check and found that seem the DataSource instantiation in client side code would cause this.

                I can reproduce this and I found that it can be fixed when I use
                DataSource.get("...")

                But if for this case, we found we have no clear logging or info in developer console in order to trigger us for this fixing... Hence not sure any possible log if for such DataSource instantiation issue...

                Comment

                Working...
                X