Problem sending messages from servlets to mobile (wap) phones

Discussion in 'Java' started by Werner Oertig, Feb 17, 2004.

  1. Hi,

    I've a problem sending data from a servlet to a mobile phone.

    On the mobile i'm using a get request to access a servlet (running
    within tomcat 4.1). The servlet then sends data back to the mobile.
    The problem is, that the data isn't received by the mobile (or at
    least I don't see anything on it). If I use a browser to send the
    request it works fine.
    I then installed a portsniffer to intercept the output from the
    servlet. And surprise, surprise suddenly the mobile receives the
    message.

    Does anybody have an explanation why I can't send the message directly
    from the servlet and why it works if there is a portsniffer in
    between?

    This is the code that I use:

    String message = content.getWapResponse();
    response.setContentType( "text/vnd.wap.wml" );
    response.setContentLength( message.length() );
    response.setStatus( HttpServletResponse.SC_OK );
    PrintWriter writer = response.getWriter();
    writer.print( message );
    writer.flush();
    writer.close();

    Thanks for your help!
     
    Werner Oertig, Feb 17, 2004
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.