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.
In WF i click on Add Service Reference past link to ediag.asmx click on GO and press OK. So now i got ServiceReference1 in my program.And now how to use it?
regards,
a.
Jan MontanoPosted Feb 23, 2009, 2:40 AM
ArucardPosted Feb 21, 2009, 10:58 AM
public static string GetVersion()
{
using (var svc = new ServiceReference1.ediagSoapClient("ediagSoap"))
{
return svc.GetVersion();
}
}
regards,
a.
ArucardPosted Feb 21, 2009, 1:54 AM
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.
Jan MontanoPosted Feb 19, 2009, 10:56 PM
What was it's name when you added it as reference?
ArucardPosted Feb 19, 2009, 3:43 PM
Error 1 The type or namespace name 'ediag' does not exist in the namespace 'programm.ServiceReference1' (are you missing an assembly reference?)
Jan MontanoPosted Feb 17, 2009, 7:55 PM
ServiceReference1.ediag ediag = new ServiceReference1.ediag();
string version = ediag.GetVersion();
ArucardPosted Feb 17, 2009, 3:30 PM
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.
LisaPosted Feb 17, 2009, 5:54 AM
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
Jan MontanoPosted Feb 15, 2009, 7:32 PM
ServiceReference1 reference = new ServiceReference1();
string version = reference.GetVersion();