0

I am testing a messaging web service, in which I created a windows form app. Added the service reference, and now try to use a method from it. But has troubles in calling it.

The reference class is something like this:

namespace WindowsFormsApp1.ServiceReference1 {
...
public interface SendWebServiceSoap {
WindowsFormsApp1.ServiceReference1.SendSMS_SingleResponse SendSMS_Single(WindowsFormsApp1.ServiceReference1.SendSMS_SingleRequest request);
...
}
}

In which the SendSMS_Single is in the SendWebServiceSoap interface. In my Form.cs I used something like ServiceReference1.SendSMS_Single but did not work. How should I call it?

Payman
  • 55
  • 1
  • 7
  • You have to create a class which implements this interface. then use your class.SendWebServiceSoap() function – Alexus Dec 18 '17 at 15:44
  • Interfaces define how a class looks on the outside, they do not contain code that "does" something. They're the code equivalent of those fake phones you see on public display in supermarkets - you get an idea of how it looks and all the buttons you can push, what the screen looks like etc, but they're don't "do" things.. – Caius Jard Dec 18 '17 at 15:45
  • I am a newcommer to C#, would you please give code snippet about it? And where to put it? in my Form.cs? – Payman Dec 18 '17 at 15:46
  • 1
    It's a little bit outside the scope of Stack Overflow to teach really basic concepts liek that without there being a specific question associated with it.. "Can you show me how to write a simple c# app using an interface" isn't a good fit for an SO question; we're here to help with specific problems you're running into (and "help! I'm new and i need assistance with coding my first app!" isn't a specific problem to us, even though it might be to you..). You need to be looking at tutorials found via search terms like "how to use a web service from c#" – Caius Jard Dec 18 '17 at 15:48
  • Possible dupe : https://stackoverflow.com/questions/756345/how-to-add-webservice-to-c-sharp-winform/756362#756362 – Drag and Drop Dec 18 '17 at 15:55
  • Please note that "did not work" is not an error description we could help with either. "Did not work" could mean your wife dropped her running chainsaw on your computer the second you wanted to press run. You need to have a more specific problem with a better description. – nvoigt Dec 18 '17 at 15:56

0 Answers0