Announcement

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

    DMI integration cannot invoke server program

    I use SmartGWT 3.0p power edition to perform a simple form submit and I use the GWT App Engine for prelim test, and I try the following

    - dynamicForm.saveData()
    - call client DataSource
    - call ds.xml config and call to server through DMI, and
    * specify the serverConstructor server endpoint class
    * specify the operationBinding and specify the serverObject with POJO
    * set serverMethod 'add'
    - call Servers' Service with method 'add'

    Questions:
    1. And as show in the code and I try to print out somethings but I cannot see anythings in the eclipse console view, where can I find the log in server side of GWT App Engine testing?
    2. I try to use debug and add a breakpoint onto server side, but I cannot reach the breakpoint, is breakpoint work for GWT App Engine in debug mode?
    3. I try to get the response status by 'DSCallback' in client side and get '0', what's the meaning of 0?
    4. how can I return the data from server back to client for construction of success message?



    Dynamic Form - (Client Side)
    Code:
    final DynamicForm dynamicForm = new DynamicForm();
    dynamicForm.setDataSource(FormSubmitDS.getInstance());
    dynamicForm.setAddOperation("add");
    final TextItem field1 = new TextItem("field1");
    final TextItem field2 = new TextItem("field2");
    
    dynamicForm.setFields(field1 , field2);
    addMember ( dynamicForm );
    IButton submitButton = new IButton("Submit");
    submitButton.addClickHandler(new ClickHandler() {
    
    	@Override
    	public void onClick(ClickEvent event) {
    		// TODO Auto-generated method stub
    		dynamicForm.saveData(new DSCallback() {
    			@Override
    			public void execute(DSResponse response, Object rawData,
    					DSRequest request) {
    				SC.say ( Integer.toString(response.getStatus()) );
    			}
    			
    		});
    		dynamicForm.resetValues();
    	}
    	
    });
    addMember(submitButton);
    Client DataSource - (Client Side)
    Code:
    public class FormSubmitDS extends DataSource {
    	private static FormSubmitDS instance = null;
    
    	public static FormSubmitDS getInstance() {
    		synchronized(FormSubmitDS.class) {			
    			if (instance == null) {
    				instance = new FormSubmitDS("FormSubmitData");
    			}
    		}
    		return instance;
    	}
    
    	public FormSubmitDS(final String id) {
    		setID(id);
    		setTitleField("FormSubmitData");
    		final DataSourceTextField field1Field = new DataSourceTextField("field1", "field1");
    		field1Field.setPrimaryKey(true);
    		field1Field.setRequired(true);
    		final DataSourceTextField field2Field = new DataSourceTextField("field2", "field2");
    		
    		setFields(field1Field , field2Field);
    		setDataURL("ds/FormSubmitData.ds.xml");
    
    //		setClientOnly(true);
    	}
    
    }
    ds.xml - (Client/Server Side)
    Code:
     <DataSource 
     	ID="FormSubmitData" 
    	serverConstructor="com.testgwt.server.FormSubmitDataService">
    	 <fields>
    	        <field name="field1" type="text" title="field1" required="true"/>
    	        <field name="field2" type="text" title="field2"/>
    	 </fields>
    	 <operationBindings>
               <binding operationType="add" serverMethod="add" operationId="add">
                   <serverObject  
                        lookupStyle="new" 
                        className="com.testgwt.server.data.FormSubmitData" />
               </binding>
         </operationBindings>	 
     </DataSource>
    Server Side Service Endpoint - (Server Side)
    Code:
    import com.isomorphic.datasource.BasicDataSource;
    import com.isomorphic.datasource.DSRequest;
    import com.isomorphic.datasource.DSResponse;
    import com.testgwt.server.data.FormSubmitData;
    
    public class FormSubmitDataService extends BasicDataSource {
    	public DSResponse add(DSRequest dSRequest, FormSubmitData o) throws Exception{
    		System.out.println("FormSubmitDataService.add");
    		System.out.println(o.getField1());
    		System.out.println(o.getField2());
    		if ( "1".equals(o.getField1()) ) {
    			throw new Exception ("ERROR" );
    		}
    	    return dSRequest.execute();
    	}
    
    }
    Server Side VO - (Server Side)
    Code:
    package com.testgwt.server.data;
    
    public class FormSubmitData {
    	private String field1;
    	private String field2;
    	
    	public String getField1() {
    		return field1;
    	}
    	public void setField1(String field1) {
    		this.field1 = field1;
    	}
    	public String getField2() {
    		return field2;
    	}
    	public void setField2(String field2) {
    		this.field2 = field2;
    	}
    }
    Last edited by wing.t.lee; 18 Mar 2013, 00:13.

    #2
    The first thing to check for a server issue is always the server-side log. This is in the Eclipse Console tab.

    Comment


      #3
      I cannot see any printout from the eclipse console, as well I putting some exception so that I can pass through the exception and break the flow but find not passing...
      Lastly I add a call back and find the response status code = 0

      Hence is there any missing on the ds.xml config? is the server side method specify wrongly?

      Comment


        #4
        First you need to figure out why you can't find the server logs. They are critical to understanding anything that could be wrong.

        Note, you should probably turn of use of GAE (Goolgle App Engine). This is for cloud hosting of applications. Given where you work (we can see your email address) it's extremely unlikely that this is intended deployment model, and GAE has a number of limitations that interfere with normal Java development.

        Comment


          #5
          Sorry to confuse you that it should have some log in the console log but my meaning is there is no the print out of my FormSubmitDataService

          Hence my question is: is there any config or coding issue that I cannot invoke FormSubmitDataService correctly?

          Comment


            #6
            Change /DataSource/operationBindings/binding to /DataSource/operationBindings/operationBinding

            Comment


              #7
              bbryun: actually both work.

              We don't know what you mean about logs already posted. You still haven't posted the server log and you need to post it or no one can help you.

              And again please review the advice about GAE.

              Comment


                #8
                typo for the 'posted'
                I have tries the two and both can be let me trigger the server side 'add' method.
                /DataSource/operationBindings/binding
                /DataSource/operationBindings/operationBinding


                And I find the printout from the eclipse console for other log, but I cannot find the log that I write in the server program, hence want to find out what's wrong for my config or server side java code

                Comment

                Working...
                X