开发者

HttpRequest from J2ME and send response from ASP.NET

I am using this J2ME code 开发者_开发知识库to send httpRequest to asp.net backend

HttpConnection connection = null;
    byte responseData[] = null;
    try {
        connection = (HttpConnection) new ConnectionFactory()
                .getConnection(URL).getConnection();
        int len = (int) connection.getLength();
        if (len != -1) {
            responseData = new byte[len];
            DataInputStream dis;
            dis = new DataInputStream(connection.openInputStream());
            dis.readFully(responseData);
        }
    } catch (Exception e) {

    }

    final byte[] responseDataToProcess = responseData;

and in asp.net I am using this code to make response

protected void Page_Load(object sender, EventArgs e)
{
//processes
Response.Write("true");
}

The problem is the client receive no response and "len" of response =-1

Thanks a lot


Make sure that your server doesn't use Chunked transfer encoding

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜