I am trying to write an application which polls a servlet on a remote server for information.

The problem is that the phone connects to the servlet (this is logged on the server) and the server makes a valid response. However the phone always displays the result to be "Cancel". Whatever text I get the servlet to return the MIDlet on the phone always displays this text. There is no place in either the servlet or the MIDlet code where this value could come from.

Does anyone know what could be causing this?

The code for the servlet and MIDlet follow.

thx for any help.

public class TestServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

PrintWriter out = response.getWriter();



connection = (HttpConnection)Connector.open(s);
os = connection.openOutputStream();
is = connection.openDataInputStream();

int ch;
while((ch = is.read()) != -1) {
sb.append((char) ch);