Announcement

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

    Question about setRecordXPath

    I'm trying to fill a grid with data returned from a web service. The service is being called and returning the expected data but the grid remains empty. I suspect it has to do with the recordXPath I'm using but it seems quite simple. Can anyone spot what I'm doing wrong. Here is the code.
    Code:
    XMLTools.loadWSDL(wsdlURL, 	new WSDLLoadCallback() {
    
    	public void execute(WebService service) {
    		if(service == null) {
    			SC.warn("WSDL not available from "+ wsdlURL, new BooleanCallback() {
    				public void execute(Boolean value) {
    				}
    			});
    		}
    		inputDS = service.getInputDS("getStandardScales");
    		OperationBinding fetchBinding = new OperationBinding();
    		fetchBinding.setRecordXPath("//Store");
    		resultsDS = service.getFetchDS("getStandardScales", "StandardScaleStore", fetchBinding);
    		setHeight("90%");
    		setWidth("100%");
    		form.setDataSource(inputDS);
    		searchButton = new IButton("Search");
    		searchButton.addClickHandler(new ClickHandler() {
    			public void onClick(ClickEvent event) {
    				resultsDS.fetchData(form.getValuesAsCriteria());
    			}
    		});
    		grid = new ListGrid();
    		grid.setDataSource(resultsDS);
    		setMembers(form, searchButton, grid);  
    	}
    });
    I've stepped through it in debug and it all appears to work correctly, just nothing showing up in the grid. Here is the response from the web service call.
    Code:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getStandardScalesResponse xmlns:ns2="http://services.allocation.ipms.islandpacific.com/"><result><statusCode>Success</statusCode><statusMessage>Request completed successfully</statusMessage><StandardScale><Id>ALLO</Id><Description>ALLOCATION PLAN MOCK UP  </Description><Store><Id>10000</Id><Value>650</Value></Store><Store><Id>10001</Id><Value>1133</Value></Store><Store><Id>10002</Id><Value>380</Value></Store><Store><Id>10003</Id><Value>399</Value></Store><Store><Id>11000</Id><Value>421</Value></Store><Store><Id>11001</Id><Value>435</Value></Store><Store><Id>11100</Id><Value>467</Value></Store><Store><Id>11101</Id><Value>360</Value></Store><Store><Id>12000</Id><Value>888</Value></Store><Store><Id>12001</Id><Value>395</Value></Store><Store><Id>13000</Id><Value>488</Value></Store><Store><Id>13001</Id><Value>687</Value></Store><Store><Id>13100</Id><Value>699</Value></Store><Store><Id>13101</Id><Value>400</Value></Store><Store><Id>14001</Id><Value>210</Value></Store><Store><Id>14000</Id><Value>640</Value></Store><Store><Id>15001</Id><Value>1157</Value></Store><Store><Id>15000</Id><Value>467</Value></Store><Store><Id>40001</Id><Value>367</Value></Store><Store><Id>40000</Id><Value>487</Value></Store><Store><Id>40003</Id><Value>375</Value></Store><Store><Id>40002</Id><Value>457</Value></Store><Store><Id>41001</Id><Value>360</Value></Store><Store><Id>41000</Id><Value>488</Value></Store><Store><Id>41102</Id><Value>410</Value></Store><Store><Id>41101</Id><Value>410</Value></Store><Store><Id>30000</Id><Value>484</Value></Store><Store><Id>20000</Id><Value>365</Value></Store><Store><Id>44410</Id><Value>311</Value></Store><Store><Id>15002</Id><Value>460</Value></Store><Store><Id>44412</Id><Value>465</Value></Store><Store><Id>44413</Id><Value>389</Value></Store><Store><Id>40</Id><Value>151</Value></Store><Store><Id>44411</Id><Value>439</Value></Store><Store><Id>8</Id><Value>133</Value></Store><Store><Id>87654</Id><Value>420</Value></Store></StandardScale></result></ns2:getStandardScalesResponse></soap:Body></soap:Envelope>
    As you can see there are lots of Store elements in the response but the recordXPath of "//Store" doesn't seem to be finding them.

    #2
    I enabled xmlSelect debug logging in the console and it shows that the XPath select is working correctly. But why don't the 36 rows selected show up in the grid?
    Code:
    09:01:54.841:XRP4:INFO:xmlSelect:selectNodes: expression: //Store returned Array[36]: 8ms
    09:01:54.841:XRP4:DEBUG:xmlBinding:selecting type: '[XSComplexType ID:StandardScaleStore]' within message 'getStandardScalesResponse via XPath: //Store got 36 elements
    09:01:54.849:XRP4:INFO:xmlBinding:isc_DataSource_87:dsResponse is: {data: Array[36],
    startRow: 0,
    status: 0,
    endRow: 35,
    totalRows: 36,
    httpResponseCode: 200,
    transactionNum: 7,
    clientContext: undef}

    Comment


      #3
      There's no way to know without seeing the WSDL, but likely problems are that the typeName passed to getFetchDS has no meaningful definition in the WSDL or it's schema doesn't match the actual data returned.

      In addition to posting the wsdl:
      - does the grid show fields?
      - if you hover over the grid after data has loaded, do there appear to be rows present, but just no data values in the columns?

      Comment


        #4
        It turns out to have nothing to do with setRecordXPath. I resolved it by changing this ...

        resultsDS.fetchData(form.getValuesAsCriteria());

        to this ...

        grid.fetchData(form.getValuesAsCriteria());

        But I'm still confused as to why that is necessary. I thought once the grid was bound to the data source any change to the data source would be reflected in the grid.

        Comment


          #5
          Oh, missed that. See the docs for DataSource.fetchData(), it is specifically for getting data from a DataSource with no impact on the UI. Grids and other dataBoundComponents do automatically update, but they update when other components make *changes* to data - they do not try to update when other components fetch data, which could be different criteria, sort order, row range, etc.

          Comment

          Working...
          X