/* * Isomorphic SmartGWT web presentation layer * Copyright 2000 and beyond Isomorphic Software, Inc. * * OWNERSHIP NOTICE * Isomorphic Software owns and reserves all rights not expressly granted in this source code, * including all intellectual property rights to the structure, sequence, and format of this code * and to all designs, interfaces, algorithms, schema, protocols, and inventions expressed herein. * * If you have any questions, please email
. * * This entire comment must accompany any portion of Isomorphic Software source code that is * copied or moved from this file. */ package com.smartgwt.sample.showcase.client.webservice; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.XMLTools; import com.smartgwt.client.data.WSDLLoadCallback; import com.smartgwt.client.data.WebService; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.util.SC; import com.smartgwt.client.util.BooleanCallback; import com.smartgwt.sample.showcase.client.PanelFactory; import com.smartgwt.sample.showcase.client.ShowcasePanel; public class WsdlDataBindingSample implements EntryPoint { public void onModuleLoad() { final Canvas canvas = new Canvas(); canvas.setWidth100(); canvas.setHeight100(); final String wsdlURL = "http://api.google.com/GoogleSearch.wsdl"; SC.showPrompt("Loading WSDL from: " + wsdlURL); XMLTools.loadWSDL(wsdlURL, new WSDLLoadCallback() { public void execute(WebService service) { if(service == null) { SC.warn("WSDL not currently available from Google (tried "+ wsdlURL+ ")", new BooleanCallback() { public void execute(Boolean value) { } }); return; } DataSource inputDS = service.getInputDS("doGoogleSearch"); DataSource resultDS = service.getFetchDS("doGoogleSearch", "ResultElement"); VLayout layout = new VLayout(20); layout.setWidth100(); layout.setHeight100(); layout.setLayoutMargin(40); final DynamicForm searchForm = new DynamicForm(); searchForm.setNumCols(4); searchForm.setWidth(500); searchForm.setDataSource(inputDS); searchForm.setValue("key", "/90Hfy0p5FxaC8YOxKoQKFFFfeKUjJWp"); searchForm.setValue("q", "[enter search here]"); searchForm.setValue("start", "0"); searchForm.setValue("maxResults", "10"); final ListGrid searchResults = new ListGrid(); searchResults.setWidth100(); searchResults.setDataSource(resultDS); IButton searchButton = new IButton("Search"); searchButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { searchResults.fetchData(searchForm.getValuesAsCriteria()); } }); layout.addMember(searchForm); layout.addMember(searchButton); layout.addMember(searchResults); canvas.addChild(layout); SC.clearPrompt(); } }); canvas.draw(); } }