I try to connect my windows form application (c#) to webservice and got problems.
My WS looks like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
///
/// Summary description for ediag
///
[WebService(Namespace = "http://localhost/ws/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class ediag : System.Web.Services.WebService {
public ediag () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string GetVersion() {
return "2.0.1";
}
}
So when i go via IE on: http://localhost:1716/admin/ws/ediag.asmx i got:
The following operations are supported. For a formal definition, please review the Service Description.
- GetVersion
And now how to use it?
regards,
a.

Jan MontanoRank #1,295 · 1.3K reputationPosted Feb 15, 2009, 2:32 PM EST
ServiceReference1 reference = new ServiceReference1();
string version = reference.GetVersion();
LisaRank #8,652 · 218 reputationPosted Feb 17, 2009, 12:54 AM EST
just create and instance of the webservice you are using
and that instance.method will allow you to call the methods in that webservice.
Thanks,
LIsa
Arucard9 reputationPosted Feb 17, 2009, 10:30 AM EST
ServiceReference1 reference = new ServiceReference1();
string version = reference.GetVersion();
i get:
Error 1 'program.ServiceReference1' is a 'namespace' but is used like a 'type'
regards,
a.
Jan MontanoRank #1,295 · 1.3K reputationPosted Feb 17, 2009, 2:55 PM EST
ServiceReference1.ediag ediag = new ServiceReference1.ediag();
string version = ediag.GetVersion();
Arucard9 reputationPosted Feb 19, 2009, 10:43 AM EST
Error 1 The type or namespace name 'ediag' does not exist in the namespace 'programm.ServiceReference1' (are you missing an assembly reference?)
Jan MontanoRank #1,295 · 1.3K reputationPosted Feb 19, 2009, 5:56 PM EST
What was it's name when you added it as reference?
Arucard9 reputationPosted Feb 20, 2009, 8:54 PM EST
Name of reference is in first post too: ServiceReference1.
I don't know what else i can write to help investigate why it doesn't work in my WF app. :(
Mabye this:
In ServiceReference1 i've got (when i write name, after that . and wait a while i got list - how is this feature called?)
.ediagSoap (interface program.ServiceReference1.ediagSoap)
.ediagSoapChannel (interface program.ServiceReference1.ediagSoapChannel)
.ediagSoapClient (class program.ServiceReference1.ediagClient)
.GetVersionRequest (class program.ServiceReference1.GetVersionRequest)
.GetVersionRequestBody (class program.ServiceReference1.GetVersionRequestBody)
.GetVersionResponse (class program.ServiceReference1.GetVersionResponse)
.GetVersionResponseBody (class program.ServiceReference1.GetVersionResponseBody)
regards,
a.
Arucard9 reputationPosted Feb 21, 2009, 5:58 AM EST
public static string GetVersion()
{
using (var svc = new ServiceReference1.ediagSoapClient("ediagSoap"))
{
return svc.GetVersion();
}
}
regards,
a.
Jan MontanoRank #1,295 · 1.3K reputationPosted Feb 22, 2009, 9:40 PM EST