Hi Peter
If have installed .NETCF Service Pack 3 onto my devices but the problem
still exists.
I am testing on smartphone 2003 and ppc 2003
I have found that calling the webservice using http post works for muliple
webrequest, so this can be a fix for me if it comes to that.
Here is some sample test code,
It works fine over gprs if I use my httprequesttest method muliple times,
if I use the my webserviceproxytest it only works once over gprs.
They both work fine if connected through acticesync.
Thanks
Brad
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Xml;
using System.IO;
using System.Text;
namespace Smartphonetester
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu2;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.MainMenu mainMenu1;
private ConfigServices.DeviceManagement deviceManagement;
private System.Windows.Forms.TextBox textBox1;
private int count = 0 ;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.mainMenu2 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox();
//
// mainMenu2
//
this.mainMenu2.MenuItems.Add(this.menuItem1);
//
// menuItem1
//
this.menuItem1.Text = "Exit";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(16, 128);
this.checkBox1.Text = "checkBox1";
this.checkBox1.Click += new System.EventHandler(this.checkBox1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(8, 16);
this.textBox1.Multiline = true;
this.textBox1.Size = new System.Drawing.Size(152, 96);
this.textBox1.Text = "textBox1";
//
// Form1
//
this.Controls.Add(this.textBox1);
this.Controls.Add(this.checkBox1);
this.Menu = this.mainMenu2;
this.Text = "Form1";
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
Application.Run(new Form1());
}
private void menuItem1_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void checkBox1_Click(object sender, System.EventArgs e)
{
webserviceproxytest();
}
private void webserviceproxytest()
{
deviceManagement = new ConfigService.DeviceManagement();
deviceManagement.Url = "mywebserviceURL";
deviceManagement.Timeout = 100000;//The default is 100 000 milliseconds.
int userid = Int32.MinValue;
FlowGroup.Crypto.MD5 md =
FlowGroup.Crypto.MD5CryptoServiceProvider.Create();
byte[] hash;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] buffer = enc.GetBytes("password");
hash = md.ComputeHash(buffer);
try
{
ConfigurationServices.ReturnCode rc = deviceManagement.AuthUser("brad",
hash, out userid);
textBox1.Text = userid.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
deviceManagement.Abort();
}
private void httprequesttest()
{
// Create a 'WebRequest' object with the specified url.
WebRequest myWebRequest = WebRequest.Create("mywebserviceURL+params");
// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();
// Obtain a 'Stream' object associated with the response object.
Stream ReceiveStream = myWebResponse.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
// Pipe the stream to a higher level stream reader with the required
encoding format.
StreamReader readStream = new StreamReader( ReceiveStream, encode );
StringBuilder output = new StringBuilder();
output.Append("\nResponse stream received");
Char[] read = new Char[256];
// Read 256 charcters at a time.
int count = readStream.Read( read, 0, 256 );
output.Append("HTML...\r\n");
while (count > 0)
{
// Dump the 256 characters on a string and display the string onto the
console.
String str = new String(read, 0, count);
output.Append(str);
count = readStream.Read(read, 0, 256);
}
textBox1.Text = output.ToString();
// Release the resources of stream object.
readStream.Close();
// Release the resources of response object.
myWebRequest.Abort();
myWebResponse.Close();
}
}
}
Peter Foot said:
Can you post a code example to illustrate the problem. Also are you
running the latest .NETCF Service Pack 3 runtimes on the device?
Peter
Peter Foot said:
Can you post a code example to illustrate the problem. Also are you
running the latest .NETCF Service Pack 3 runtimes on the device?
Peter