Hi
I am trying to invoke webservices from smartgwt api,
This is the code i was written to invoke a method named sayHello, I have supposed to get a message "Hello <some name>" but it is always getting null printed
can you please help me where i am doing the mistake
Thanks
Pavan
I am trying to invoke webservices from smartgwt api,
Code:
package com.example.myproject.client; import java.util.LinkedHashMap; import java.util.Map; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.WSDLLoadCallback; import com.smartgwt.client.data.WebService; import com.smartgwt.client.data.WebServiceCallback; import com.smartgwt.client.data.XMLTools; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.ButtonItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.form.fields.events.ClickEvent; import com.smartgwt.client.widgets.form.fields.events.ClickHandler; import com.smartgwt.client.widgets.layout.HLayout; import com.google.gwt.core.client.JavaScriptObject; import com.smartgwt.client.rpc.RPCManager; import com.smartgwt.client.rpc.RPCResponse; public class SmartGWTWebservices implements EntryPoint { private WebService myservice; public void onModuleLoad(){ HLayout hl = new HLayout(); MyForm mi=new MyForm(); hl.addMember(mi); final MyForm form=new MyForm(); ButtonItem bi = new ButtonItem("ClickMe"); bi.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { SC.say("Clicked the button...."); form.callService(); } }); form.setItems(bi); hl.addMember(form); //RPCManager.setUseHttpProxy(true); XMLTools.loadWSDL("https://somehost/HelloService/remoting/helloService?wsdl", new WSDLLoadCallback() { public void execute(WebService webService) { myservice = webService; } }); hl.setWidth(Page.getWidth()); hl.draw(); } class MyForm extends DynamicForm{ public void callService(){ if(myservice==null){ SC.say("Still Processing Try again......"); }else{ Map inputData = new LinkedHashMap(); inputData.put("Name", "Pavan"); //RPCManager.setUseHttpProxy(true); myservice.callOperation("sayHello",inputData,null, new WebServiceCallback() { public void execute(Object[] data, JavaScriptObject xmlDoc, RPCResponse rpcResponse, JavaScriptObject wsRequest) { SC.say("Hi, " + ((JavaScriptObject)data[0])); SC.say("Hello " + new TextItem((JavaScriptObject)data[0]).getValueAsString()); } }); } } } }
can you please help me where i am doing the mistake
Thanks
Pavan
Comment