By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,185 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,185 IT Pros & Developers. It's quick & easy.

Windows Client for XML Web Service

P: n/a
I have developed my web service with a domain name of my computer name and
wwwroot directory. I also developed a client of windows form application. It
works locally (i.e. in the same machine).

When I copy my client application to another machine and start it, I got an
error about initialized problem.

Note that I can browser my web service .asmx file from the second machine.

The sample client source code:
-----
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace WindowsApplicationWebServices
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lbHello;
private System.Windows.Forms.Button btnHello;
private System.Windows.Forms.Button BtnAdd;
private System.Windows.Forms.TextBox txtA;
private System.Windows.Forms.TextBox txtB;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtResult;
//Dabin
private WindowsApplicationWebServices.TestWebServiceRef.Te stWebService
ProxyTestWebService;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//

//Dabin
ProxyTestWebService = new
WindowsApplicationWebServices.TestWebServiceRef.Te stWebService();

}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
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.lbHello = new System.Windows.Forms.Label();
this.btnHello = new System.Windows.Forms.Button();
this.BtnAdd = new System.Windows.Forms.Button();
this.txtA = new System.Windows.Forms.TextBox();
this.txtB = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtResult = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// lbHello
//
this.lbHello.Location = new System.Drawing.Point(168, 32);
this.lbHello.Name = "lbHello";
this.lbHello.TabIndex = 0;
//
// btnHello
//
this.btnHello.Location = new System.Drawing.Point(48, 32);
this.btnHello.Name = "btnHello";
this.btnHello.TabIndex = 1;
this.btnHello.Text = "ShowHello";
this.btnHello.Click += new System.EventHandler(this.btnHello_Click);
//
// BtnAdd
//
this.BtnAdd.Location = new System.Drawing.Point(48, 72);
this.BtnAdd.Name = "BtnAdd";
this.BtnAdd.TabIndex = 2;
this.BtnAdd.Text = "Add";
this.BtnAdd.Click += new System.EventHandler(this.BtnAdd_Click);
//
// txtA
//
this.txtA.Location = new System.Drawing.Point(184, 72);
this.txtA.Name = "txtA";
this.txtA.Size = new System.Drawing.Size(56, 20);
this.txtA.TabIndex = 3;
this.txtA.Text = "";
//
// txtB
//
this.txtB.Location = new System.Drawing.Point(264, 72);
this.txtB.Name = "txtB";
this.txtB.Size = new System.Drawing.Size(56, 20);
this.txtB.TabIndex = 4;
this.txtB.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(248, 72);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(8, 16);
this.label2.TabIndex = 5;
this.label2.Text = "+";
//
// label3
//
this.label3.Location = new System.Drawing.Point(328, 72);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(24, 23);
this.label3.TabIndex = 6;
this.label3.Text = "=";
//
// txtResult
//
this.txtResult.Location = new System.Drawing.Point(352, 72);
this.txtResult.Name = "txtResult";
this.txtResult.Size = new System.Drawing.Size(56, 20);
this.txtResult.TabIndex = 7;
this.txtResult.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(512, 250);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.txtResult,
this.label3,
this.label2,
this.txtB,
this.txtA,
this.BtnAdd,
this.btnHello,
this.lbHello});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void btnHello_Click(object sender, System.EventArgs e)
{
lbHello.Text = ProxyTestWebService.HelloWorld();
}

private void BtnAdd_Click(object sender, System.EventArgs e)
{
txtResult.Text =
System.Convert.ToString(ProxyTestWebService.Add(Sy stem.Convert.ToInt32(txtA.Text.ToString()), System.Convert.ToInt32(txtB.Text.ToString())));
}
}
}
---------

Anyone could give me a help?

Thank you.

David
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
david <da***@discussions.microsoft.com> ha scritto:
When I copy my client application to another machine and start it, I
got an
error about initialized problem.


Firewall? Uri incorrect in the proxy application?

--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
Nov 19 '05 #2

P: n/a
No, there is no firewall.

Do I need deploy the client application and install it in the client computer?
Does the client computer need the .NET framework installed?

David

"Andrea Zani" wrote:
david <da***@discussions.microsoft.com> ha scritto:
When I copy my client application to another machine and start it, I
got an
error about initialized problem.


Firewall? Uri incorrect in the proxy application?

--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az

Nov 19 '05 #3

P: n/a
david <da***@discussions.microsoft.com> ha scritto:
Do I need deploy the client application and install it in the client
computer?
If the URI for the web services is absolute, no.
Does the client computer need the .NET framework installed?
For the windows application is necessary.

David


--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
Nov 19 '05 #4

P: n/a
Thanks.
I will try.
You mean that I only need to copy the client .exe file to client machine and
run it, is that right?

"Andrea Zani" wrote:
david <da***@discussions.microsoft.com> ha scritto:
Do I need deploy the client application and install it in the client
computer?


If the URI for the web services is absolute, no.
Does the client computer need the .NET framework installed?


For the windows application is necessary.

David


--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az

Nov 19 '05 #5

P: n/a
david <da***@discussions.microsoft.com> ha scritto:
Thanks.
I will try.
You mean that I only need to copy the client .exe file to client
machine and run it, is that right?


Yes.

When you create the proxy class, declare the abolsute URI for the web
services.

--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.