当前位置: 代码迷 >> Windows Mobile >> 客户端怎么通过专用APN访问WebService
  详细解决方案

客户端怎么通过专用APN访问WebService

热度:111   发布时间:2016-04-25 07:50:37.0
客户端如何通过专用APN访问WebService
我在程序里建立了一个专用APN连接,想让客户端通过APN访问服务器的WebService,其中一个原则,不通过手动设置系统默认的接入点来实现。
因此,在程序中,第一步,我先连接该APN网络;第二步,访问WebService。问题在于第二步的访问WebService并不通过我第一步连接的APN网络来访问网络,而是通过了系统的默认访问点,结果肯定访问不到。有没有什么办法,强制客户端通过特定的APN访问WebService访??谢谢!
代码如下(C#+OpenNetCF)

第一步:
/连接公司的APN连接
  public void ConnGPRS()
  {
   
  cenum = ConnMgr.EnumDestinations();
  try
  {
  foreach (DestinationInfo em in cenum)
  {

  if (em.Description == "APN专网")  
  {
  ConnMgr.Connect(em.Guid, true, ConnectionMode.Asynchronous);  
  }

  }

  }
  catch (SystemException err)
  {
  MessageBox.Show(" err 700 " + err.Message);
  }
  }

第二步:
//访问WebService
 private void button1_Click(object sender, EventArgs e)
  {

  try
  {
  string type = domainUpDown1.SelectedIndex.ToString();
  ws_info.Contact ws = new PPC6.ws_info.Contact();
  ws.Url = "http://10.49.28.30/ws_info/contact.asmx";
  string strRet = ws.getContact(type, textBox1.Text.Trim());
  if (type == "0")
  {
  tb_mobile.Text = strRet;
  tb_name.Text = textBox1.Text.Trim();
  }
  else
  {
  tb_mobile.Text = textBox1.Text.Trim();
  tb_name.Text = strRet;
  }
  }
  catch(Exception ex)
  {
  MessageBox.Show("错误:"+ex.Message);
  }
   
  }


------解决方案--------------------
不成,CE底下不支持这样用.不像SYMBIAN可以拿APN,拿接入点.
------解决方案--------------------
帮顶
------解决方案--------------------
不懂,up
------解决方案--------------------
不懂,up
------解决方案--------------------
退一步的办法,是否可以考虑使用一下Proxy呢
------解决方案--------------------
C#的没弄过,win32还OK了。
可以使用连接管理器的API建立独占性的连接,然后在你的应用中使用这个连接就行了。
  相关解决方案