| | |
Java ME App calling a servlet
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Feb 2007
Posts: 27
Reputation:
Solved Threads: 1
I'm writing a Java ME app that will access servlets on a tomcat server, (version 5.5) and I'm having a problem. In my client I'm trying to use a HTTP connection to the servlet, like so:
I'm running it on an emulator on the machine, which is compiling the code. However it is giving me an cannot find symbol error and pointing to the URL.
Additional info:
localhost:8080/nurse is a webservice that I've deployed.
I've tried using the ip address of the machine instead, but I'm getting the same error again.
Tomcat is running.
NurseServer is the class that I want to call, (which is compiled propperly).
doPost is the method that, from what I'm understand, you have to call from the client.
Any suggestions as to what is the problem? Any addition info need, just ask.
Java Syntax (Toggle Plain Text)
if (command == select && currentForm == login) { HttpConnection connection = null; InputStream inputstream = null; try { int id = Integer.parseInt(loginTF[0].getString()); } catch (NumberFormatException e) { System.out.println("Invalid number type" + e); } String pword = loginTF[1].getString(); try { connection = (HttpConnection) Connector.open("http://localhost:8080/nurse/NurseServer.doPost?method=login&userID="+id+"&password="+pword); connection.setRequestMethod(HttpConnection.GET); connection.setRequestProperty("Content-Type", "//textplain"); connection.setRequestProperty("Connection", "close"); } catch (IOException e) { System.out.println("Error at client login: " + e.toString()); } }
I'm running it on an emulator on the machine, which is compiling the code. However it is giving me an cannot find symbol error and pointing to the URL.
Additional info:
localhost:8080/nurse is a webservice that I've deployed.
I've tried using the ip address of the machine instead, but I'm getting the same error again.
Tomcat is running.
NurseServer is the class that I want to call, (which is compiled propperly).
doPost is the method that, from what I'm understand, you have to call from the client.
Any suggestions as to what is the problem? Any addition info need, just ask.
Nel sogni, come in amore, non ci sono cose impossible
![]() |
Similar Threads
- Error coming while running an App (JSP)
- Execute Java app question (Java)
- about java servlets (Java)
- Keeping a Java App. Open but Closing One of the Windows (Java)
- Some Simple Console App Questons (Java) (Java)
- line up JTextField GUI java & write to file (Java)
- Finding an IP address using Java (was: do u know?) (Java)
Other Threads in the Java Forum
- Previous Thread: Asterisks Pattern Help!
- Next Thread: JRE1.4.2_13 Proxy Configuration:No proxy
Views: 1733 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for Java
3d @param affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth byte c# chat class classes click client code color compare component corrupted database detection draw eclipse error event exception file fractal game givemetehcodez graphics gui guitesting helpwithhomework html ide image input integer j2me java java.xls javaprojects jmf jni jpanel julia keytool keyword linux list loop map method methods mobile netbeans newbie number object oracle pong print problem producer program programming project projectideas read recursion reflection replaysolutions rim scanner screen server set size sms socket sort sql string swing terminal test threads time tree web windows





