Help-->Do I need a domain name or IP is enough ?

Hi Everyone,

I had posted earlier regarding my application that it doesnt work on a real device but works on every manufacturers emulator !

I have got ADSL and I m using my IP address to access my Tomcat server and I m passing parameters in the URL :

http://xxx.xxx.xxx.xxx/servlet?param1&param2&param3&param4

I havent specified anything in my application like GET or POST just passing values in URL.

So, do I need to have a specifc domain name since I m not using GET or POST ?

Please guide.

Thank you.

[564 byte] By [siddhsdesaia] at [2007-10-3 3:10:39]
# 1
No, IP should work.Are you sure your webserver is available though your external IP address?
deepspacea at 2007-7-14 21:01:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
Thanks for your reply deepspace.Yes, its accessible through external IP address since I tested a sample application and it worked just fine.So, any other suggestions please ?thank you.
siddhsdesaia at 2007-7-14 21:01:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
> Yes, its accessible through external IP address since> I tested a sample application and it worked just> fine.How did you test that?
deepspacea at 2007-7-14 21:01:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
I tested it using a simple servlet wherein mobile application would connect to the servlet and servlet would give number of hits. http://developers.sun.com/techtopics/mobility/midp/articles/tutorial2/src/HitMIDlet.javaThats the one I used to test.
siddhsdesaia at 2007-7-14 21:01:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5
Using the external ip of the server webserver?
deepspacea at 2007-7-14 21:01:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6
yes, deepspace.I used the same external IP of the webserver in the format: http://xxx.xxx.xxx/servletand it works fine.Message was edited by: siddhsdesai
siddhsdesaia at 2007-7-14 21:01:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 7
? Anyone, please ?
siddhsdesaia at 2007-7-14 21:01:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 8
If that works.. what doesn't?
deepspacea at 2007-7-14 21:01:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 9

The problem that I m facing is I m not able to send a request from my MIDLet.

Intrestingly I m able to send a request from my mobile browser which does connect to the web server !!

I m using a WaitScreen which acts as a thread for connecting to the server and when I get response from the server, imge is displayed on the form. Everything works fine on an emulator but from device it doesnt work...

The size of that image is roughly around 20-25 KB and device specifications are CLDC 1.1 and MIDP 2.0 and there is enough memory in my device to hold the image.

Do you see any potential problem ?

siddhsdesaia at 2007-7-14 21:01:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 10
Show us some code...
deepspacea at 2007-7-14 21:01:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 11

Here is the code...

//This is the WaitScreen from where I m making a function call to get image

if (simpleCancellableTask1 == null) {

// Insert pre-init code here

simpleCancellableTask1 = new org.netbeans.microedition.util.SimpleCancellableTask();

simpleCancellableTask1.setExecutable(new org.netbeans.microedition.util.Executable() {

public void execute() throws Exception {

im=getImage(url);

get_Image1Form().append(im);

}

});

}

return simpleCancellableTask1;

}

//Code for making connection and getting image

private Image getImage(String url) throws IOException

{

int width=mainForm.getWidth();

int height=mainForm.getHeight();

String serverUrl="http://localhost:8080/imageservlet";

String httpUrl=serverUrl +"?width=" +width + "&height="+height + "&from="+from+"&to="+to;

ContentConnection connection= (ContentConnection) Connector.open(httpUrl);

DataInputStream iStrm = connection.openDataInputStream();

ByteArrayOutputStream bStrm = new ByteArrayOutputStream();

int firstfile,secondfile;

byte imageData[] = null;

byte imageData2[]=null;

try

{

int length =(int) connection.getLength();

firstfile=iStrm.readInt();

imageData=new byte[firstfile];

iStrm.readFully(imageData);

secondfile=iStrm.readInt();

imageData2=new byte[secondfile];

iStrm.readFully(imageData2);

}catch(Exception ex)

{

System.out.println("here is "+ex.getMessage());

showAlert(ex.getMessage());

}finally

{

if(iStrm !=null)

iStrm.close();

bStrm.close();

if(connection !=null)

connection.close();

}

img=Image.createImage(imageData,0,imageData.length);

img1 =Image.createImage(imageData2,0,imageData2.length);

return img;

}

So please tell me if there is anything wrong in here...

Thank you

siddhsdesaia at 2007-7-14 21:01:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 12
**bump**anyone ? deepspace ?
siddhsdesaia at 2007-7-14 21:01:27 > top of Java-index,Java Mobility Forums,Java ME Technologies...