2
I created a Webservice WCF, and at the interface IService1.cs
I put the signature of the methods
[ServiceContract]
public interface IService1 {
[OperationContract] bool insertConsulta(BConsulta bCos);
[OperationContract] bool alterConsulta(BConsulta bCos);
}
From there I implemented this interface on the web service Service1.svc
, and stayed like this
public class Service1 : IService1 {
NConsulta nCos = new NConsulta();
public bool insertConsulta(BConsulta bCos) {
return nCos.insertConsulta(bCos);
}
public bool alterConsulta(BConsulta bCos) {
return nCos.alterConsulta(bCos);
}
}
Then I referenced the Web Service to the project and put as the name of this reference as localhost
.
In Windows Form I installed Webservice
localhost.Service1 service = new localhost.Service1();
The following problem when I want to consume the web service it gives an error in the methods of the web service that has return bool, on the interface I ask 1 parameter and when I put service.insertConsulta(bCos);
, he asked but 2 wall and says the following:
void Service1.insertConsulta(BConsulta bCos, out bool insertConsultaResult, out bool insertConsultaResultSpecified)
The other methods that have as return void
work normally, but those who have boolean return appears this error, Dai I do not know what to do !
I’m putting this event at the click of a button, then an error appeared
Cannot implicity convert type void to bool
– Ikaro Sales
You may not use the call to
service.insertConsulta
an if (likeif (service.insertConsulta(...))
- since the method returns nothing. I updated the answer with what you can do. Or you can recreate the reference using the Add Service Reference instead of the Add Web Service Reference.– carlosfigueira
Stopped giving error, but when I run it does not work
– Ikaro Sales