SmartGWT Power, 12/19/2010 Nightly Build
I've been reading the docs and the forum as well as the 2 WSDL examples to build a ListGrid that loads data from a web service. I'm able to load the WSDL and the types, set up an input datasource, make the call, see it hit my service, and see the response data in the raw response via the developer's console RPC tab. Summary, I know the round trip request/response is good.
What I can't do is load the results in a grid; I'm missing something fundamental. Here's the block:
This runs as expected. Loads a form with a destId input in which I can place a value and see it in the request. The request:
Here's the soap response:
If you need the WSDL, I can provide it.
Thanks, all help is much appreciated.
I've been reading the docs and the forum as well as the 2 WSDL examples to build a ListGrid that loads data from a web service. I'm able to load the WSDL and the types, set up an input datasource, make the call, see it hit my service, and see the response data in the raw response via the developer's console RPC tab. Summary, I know the round trip request/response is good.
What I can't do is load the results in a grid; I'm missing something fundamental. Here's the block:
Code:
private final String wsOperation = "FindWebDestinations"; private final String wsdlURL = "http://...."; XMLTools.loadWSDL(wsdlURL, new WSDLLoadCallback() { public void execute(WebService service) { if (service == null) { SC.warn("WSDL not currently available from A100 (tried " + wsdlURL + ")", new BooleanCallback() { public void execute(Boolean value) { } }); return; } DataSource inputDS = service.getInputDS(wsOperation); final DynamicForm form = new DynamicForm(); form.setNumCols(3); form.setWidth(500); form.setDataSource(inputDS); OperationBinding ob = new OperationBinding(DSOperationType.FETCH, wsdlURL); ob.setRecordName("destinations"); ob.setWsOperation(wsOperation); ob.setUseFlatFields(true); DataSource resultsDs = new DataSource(); resultsDs.setOperationBindings(ob); resultsDs.setRecordName("destinations"); resultsDs.setDataFormat(DSDataFormat.XML); resultsDs.setUseFlatFields(true); DataSourceField f1 = new DataSourceField("destId", FieldType.INTEGER); DataSourceField f2 = new DataSourceField("destName", FieldType.TEXT); // f1.setValueXPath("destId"); // f2.setValueXPath("destName"); resultsDs.setFields(f1, f2); resultsDs = service.getFetchDS(wsOperation, "DestinationSelectType", ob); final ListGrid destinationsGrid = new ListGrid(); destinationsGrid.setWidth100(); destinationsGrid.setDataSource(resultsDs); IButton fetchButton = new IButton("Fetch"); fetchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { destinationsGrid.fetchData(form.getValuesAsCriteria()); } }); VLayout layout = new VLayout(20); layout.setWidth100(); layout.setHeight100(); layout.setLayoutMargin(40); layout.addMember(form); layout.addMember(fetchButton); layout.addMember(destinationsGrid); canvas.addChild(layout); SC.clearPrompt(); } }, new RPCRequest(), true);
Code:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Header/> <soap:Body xmlns:ns0="http://www.company.com/ws/CampaignOperations/"> <ns0:FindWebDestinations> <destId>1</destId> </ns0:FindWebDestinations> </soap:Body> </soap:Envelope>
Code:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns3:FindWebDestinationsResponse xmlns:ns2="http://www.company.com/ws/CampaignManagementTypes" xmlns:ns3="http://www.company.com/ws/CampaignOperations/"> <destinations> <ns2:destId>1</ns2:destId> <ns2:destName>Destination One</ns2:destName> </destinations> <destinations> <ns2:destId>9</ns2:destId> <ns2:destName>Destination 9</ns2:destName> </destinations> <destinations> <ns2:destId>22</ns2:destId> <ns2:destName>Destination Twenty Two</ns2:destName> </destinations> </ns3:FindWebDestinationsResponse> </soap:Body> </soap:Envelope>
Thanks, all help is much appreciated.
Comment