做过Symbian 推送通知服务程序的兄弟帮个忙啊多谢了!

做过Symbian 推送通知服务程序的兄弟帮个忙啊!谢谢了!!
本帖最后由 zhujian_1986 于 2011-10-17 16:30:43 编辑 Nokia Symbian Notifications Service API  

大体的需求,写一个访问Nokia Notification Service API这个HTTP REST接口的程序,然后向手机客户端应用发通知消息。目前官网上有Java,Python,Perl三种语言的示例,但是我这里需要用.Net来实现。目前针对Java版本,写了一个.Net版本,但是目前存在些问题,因此想请教下各位大虾。
先说下Call这个API需要的参数信息:

service_id:服务ID  
service_secret:服务密码  
payload:通知的内容
nid:通知ID
jid:用户ID
application_id:目标应用的ID  

目前我们是通过nid来Push Notification,因此不需要用到jid与application_id。
所请求的连接是一个https: https://alpha.one.ovi.com/nnapi/1.0/nid/{Notification ID}  
例如: https://alpha.one.ovi.com/nnapi/1.0/nid/5JnYUYiBqs3PH2AeeIqqBBAoYaT22vwtjw4OCAQqm0D%2btXCbl989ke0PKUp5C1NnJsYJiSHJzvE51o%2btxwJXhOwD4stUtTe%2ff2kT%2bh%2f%2f4FW9Htu%2fJFMsN2fGvWZ41Ffr



现在的关键是sendHttpPost这个方法:
以下是官方Java示例:
/*** Executes the HTTP POST request to the Notifications API.   
* @param headerParameters header parameter for the POST request.
* @param requestUri uri for the request.
*/
  private void sendHttpPost(List<NameValuePair> headerParameters, String requestUri) {
   //Create the HTTP POST Request
   HttpPost httpPost = new HttpPost(requestUri.toString());
   try {
   httpPost.setEntity(new UrlEncodedFormEntity(headerParameters, "UTF-8"));
   } catch (UnsupportedEncodingException e) {
   throw new RuntimeException("Encoding error while converting HTTP parameters to UTF-8.", e);
   }
     
  //Push the notification with HTTPS client
   try {
   HttpResponse response = client.execute(httpPost);
   System.out.println("HTTP Response from Notifications API: " + response.getStatusLine().getStatusCode());
   if(response.getEntity() != null) {
   response.getEntity().consumeContent();
   }
   } catch (IOException e) {
   throw new RuntimeException("HTTP POST Request to " + requestUri.toString() + " failed with error: " + e.getMessage());
   }
   }


目前.Net版本是这么写的:

   public string sendHttpPost(List<KeyValuePair<string, string>> headerParameters, String requestUri)
   {
   string results = string.Empty;
   StringBuilder paraString = new StringBuilder();
   if (!(headerParameters == null || headerParameters.Count == 0))
   {
   int i = 0;
   foreach (var item in headerParameters)
   {
   if (i > 0)
   paraString.AppendFormat("&{0}={1}", item.Key, item.Value);
   else
   paraString.AppendFormat("{0}={1}", item.Key, item.Value);
   i += 1;
   }
   }
   Encoding UTF8encoding = Encoding.GetEncoding("utf-8");