Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Web Services
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Ron McLeod
paul wheaton
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Himai Minh
Bartenders:
Forum:
Web Services
Mobile WS
feda alshahwan
Ranch Hand
Posts: 170
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I created a web service that adds two integers and tried to consume it from a mobile device using WSA but it just hanged and did not work the code is as follows:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package additionserviceservice; import client.AdditionService; import client.AdditionService_Stub; import java.rmi.RemoteException; import javax.microedition.lcdui.*; import javax.microedition.midlet.*; /** * @author Welcome */ public class MobileMidlet extends MIDlet implements CommandListener { private Display d; private Command okCommand; TextField f = new TextField("Integer 1", null, 20, TextField.ANY); TextField f2 = new TextField("Integer 2", null, 20, TextField.ANY); public void startApp() { try { d = Display.getDisplay(this); Form f1 = new Form("Consuming Addition Service"); f1.append(f); f1.append(f2); f1.addCommand(getOkCommand()); f1.setCommandListener(this); d.setCurrent(f1); } catch (Exception ex) { ex.printStackTrace(); } } public Command getOkCommand() { if (okCommand == null) { // write pre-init user code here okCommand = new Command("Ok", Command.OK, 0); // write post-init user code here } return okCommand; } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable d) { try{ AdditionServiceService service = new AdditionServiceService_Stub(); char ch[] = new char[5]; char ch2[] = new char[4]; int n = f.getChars(ch); int n1 = f2.getChars(ch2); String s1 = "" + ch[0] + ch[1]; String s2 = "" + ch2[0] +ch2[1]; int result = service.Add(Integer.parseInt(s1), Integer.parseInt(s2)); Alert a = new Alert("Results of WebService"); a.setString("" + result); Display.getDisplay(this).setCurrent(a); } catch(Exception ex){ } } }
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
how to send email from j2me using Servlets
javax.microedition.io.ConnectionNotFoundException: TCP open
J2ME, servlet and database help..
choicegroup not gettin displayed
Consuming "Hello"web service from mobile
More...