HttpURLConnection conn.getRequestProperty return null

Viewed 17316

I'm trying to push some data to an URL (MDS_CS) for a BES

when i set some Request Headers in my code, and submit the request, the submited request's header is set to null.

here is my code :

        HttpURLConnection conn =(HttpURLConnection)url.openConnection();
        conn.setDoInput(true);//For receiving the confirmation
        conn.setDoOutput(true);//For sending the data
        conn.setRequestMethod("POST");//Post the data to the proxy
        conn.setRequestProperty("X-Rim-Push-ID", pushId);
        conn.setRequestProperty("Content-Type", "text/html");
        conn.setRequestProperty("X-Rim-Push-Title", "-message");
        conn.setRequestProperty("X-Rim-Push-Type", "browser-message");                 
        conn.setRequestProperty("X-Rim-Push-Dest-Port", "7874");            
        //Write the data
        OutputStream out = conn.getOutputStream();
        out.write(data.getBytes());
        out.close();

        System.out.println(conn.getHeaderField("X-Rim-Push-ID"));

the last line return null when i try to retrieve the X-Rim-Push-Title it is NULL only X-Rim-Push-ID which is correctly retrieved,

please help me

3 Answers
Related