Announcement

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

    DataSource.xmlSerializeFields() broken since svn rev 827

    Simple test using WSDataSource and SmartClientOperations.wsdl:
    Code:
    package org.yournamehere.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.Criteria;
    import com.smartgwt.client.data.DSCallback;
    import com.smartgwt.client.data.DSRequest;
    import com.smartgwt.client.data.DSResponse;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.WSDLLoadCallback;
    import com.smartgwt.client.data.WSDataSource;
    import com.smartgwt.client.data.WebService;
    import com.smartgwt.client.data.XMLTools;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.types.DSDataFormat;
    import com.smartgwt.client.util.SC;
    
    public class MainEntryPoint implements EntryPoint {
        
        public MainEntryPoint() {
        }
        
        public void onModuleLoad() {
            SC.showConsole();
            final DataSource ds = new WSDataSource();
            ds.setDataFormat(DSDataFormat.XML);
            ds.setRecordXPath("/List/country");
            ds.setDataURL("data.xml");
            DataSourceTextField continentField = new DataSourceTextField("continent", "Continent");
            ds.setFields(continentField);
    
            XMLTools.loadWSDL("SmartClientOperations.wsdl", new WSDLLoadCallback() {
    
                public void execute(WebService webService) {
                    ds.fetchData(new Criteria("continent", "a"), new DSCallback() {
    
                        public void execute(DSResponse response, Object rawData, DSRequest request) {
                            System.out.println("Done - see data element at the Developer Console, RPC Tab, WSRequest");
                        }
                    });
                }
            });
        }
    }
    The Developer Console WSRequest output with current smartgwt.jar reads:
    Code:
    <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header></soap:Header>
        <soap:Body
                     xmlns:ns0="urn:operations.smartclient.com">
            
            <ns0:fetchRequest>
                <dataSource>isc_OID_0</dataSource>
                <operationType>fetch</operationType>
                <data/>
            </ns0:fetchRequest>
        </soap:Body>
    </soap:Envelope>
    data element is empty !
    While the Developer Console WSRequest output with smartgwt.jar from svn 827 (SmartClient 7.0RC3) reads:
    Code:
    <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header></soap:Header>
        <soap:Body
                     xmlns:ns0="urn:operations.smartclient.com">
            
            <ns0:fetchRequest>
                <dataSource>isc_OID_0</dataSource>
                <operationType>fetch</operationType>
                <data>
                    <continent>a</continent>
                </data>
            </ns0:fetchRequest>
        </soap:Body>
    </soap:Envelope>
    data element properly filled.

    SmartClientOperations.wsdl is taken from the current svn.

    The problem lays at the end of DataSource.js xmlSerializeFields fuction:
    Code:
            // if there's any data left, tack them on the end, but *not* if this DataSource came
            // form XML Schema, in which case the extra data is sure to be invalid
            if (!flatData && !isc.isA.Schema(this)) {
                for (var fieldName in data) {
                    output.append(this.xmlSerializeField(fieldName, data[fieldName], flags, indent));
                }
            }
    Changing:
    if (!flatData && !isc.isA.Schema(this)) {
    to:
    if (!flatData) {
    resolves this issue (at least for me) and I am a little bored patching it every svn update I did.

    Should I create new issue at the smartgwt project hosting ?
    Just want to fix it permanently.
    MichalG
Working...
X