sent from J2ME to webServer
-
hi everybody (SORRY FOR MY BAD ENGLISH) i want to send something from mobile application wrote in J2ME to web server wrote in JSP with JAVA Servlet my question is how to get the string sent from J2ME to Web Server the code for J2ME is
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*//**
*
* @author William
*/
public class midle extends MIDlet implements CommandListener {private static String defalutUrl="http://localhost:8080/DeleteWebApplication/RomaServlet"; //GUI to input string form the user private Display myDisplay=null; private Form mainScreen; private TextField requestField; //GUI for displaying header information private Form resultScreen; private StringItem resultField; //the "SEND" button used in the mainScreen Command sendCommand = new Command("SEND", Command.OK, 1); //the "BACK" button used in the resultScreen Command backCommand = new Command("BACK", Command.OK, 1); public midle() { myDisplay=Display.getDisplay(this); mainScreen=new Form("ROMA4EVER"); requestField=new TextField("enter a string please", "", 100, TextField.ANY); mainScreen.append(requestField); mainScreen.addCommand(sendCommand); mainScreen.setCommandListener(this); } public void commandAction(Command c, Displayable d) { if(c==sendCommand){ //retrieving the String that user had entered String requestString= requestField.getString(); //sending a POST request to the web server String resultString= sendPostRequest(requestString); //displaying the response back from the web server resultScreen=new Form("Azzuri"); resultField=new StringItem(null,resultString); resultScreen.append(resultField); resultScreen.ad
-
hi everybody (SORRY FOR MY BAD ENGLISH) i want to send something from mobile application wrote in J2ME to web server wrote in JSP with JAVA Servlet my question is how to get the string sent from J2ME to Web Server the code for J2ME is
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*//**
*
* @author William
*/
public class midle extends MIDlet implements CommandListener {private static String defalutUrl="http://localhost:8080/DeleteWebApplication/RomaServlet"; //GUI to input string form the user private Display myDisplay=null; private Form mainScreen; private TextField requestField; //GUI for displaying header information private Form resultScreen; private StringItem resultField; //the "SEND" button used in the mainScreen Command sendCommand = new Command("SEND", Command.OK, 1); //the "BACK" button used in the resultScreen Command backCommand = new Command("BACK", Command.OK, 1); public midle() { myDisplay=Display.getDisplay(this); mainScreen=new Form("ROMA4EVER"); requestField=new TextField("enter a string please", "", 100, TextField.ANY); mainScreen.append(requestField); mainScreen.addCommand(sendCommand); mainScreen.setCommandListener(this); } public void commandAction(Command c, Displayable d) { if(c==sendCommand){ //retrieving the String that user had entered String requestString= requestField.getString(); //sending a POST request to the web server String resultString= sendPostRequest(requestString); //displaying the response back from the web server resultScreen=new Form("Azzuri"); resultField=new StringItem(null,resultString); resultScreen.append(resultField); resultScreen.ad
You have to call a method (public, web method) in your web server from the app with passing the arguments.
I appreciate your help all the time... CodingLover :)
-
You have to call a method (public, web method) in your web server from the app with passing the arguments.
I appreciate your help all the time... CodingLover :)
would you give me an example thank you
-
would you give me an example thank you
Haven't you search on the web? http://www.oracle.com/technetwork/articles/javaee/j2ee-ws-140408.html
I appreciate your help all the time... CodingLover :)