I can't name my web service from a C # Forms application

I have a website that has a simple web service. I can successfully call the web service from javascript on the page. I need to be able to call the same web service from a C # forms application. The web service code is very simple:

[WebService(Namespace = "http://myurl.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class IDCService : System.Web.Services.WebService {

    public IDCService () {
    }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }

My javascript is working:

        function HelloWorld() {
            var yourName = $get('txtYourName').value;
            alert(yourName);
            IDCService.HelloWorld(HelloWorldCalback, failureCB);
        }

        function HelloWorldCalback(result) {
            alert(result);
        }

        function failureCB(result) {
            alert("Failed");
        }

However, when I try to establish a link to WS in my C # code, what I expect to see is an object with the HelloWorld method, what I actually see is an object with properties like HelloWorldRequest, HelloWorldResponse "," HelloWorldRequestBody "etc.

I am new to web services and am very confused. Any help would be appreciated.

+3
source share
1

, : -)

, " -", , - , "MySVC".

Winforms:

MySVC.MyTestService svc = new MySVC.MyTestService();
string message = svc.HelloWorld();

, , HelloWorld.

, " " ( ), - WCF -), . xxxxClient , :

MyWCFService.MyTestServiceSoapClient client = 
     new MyWCFService.MyTestServiceSoapClient();
string message = client.HelloWorld()

, -.

+5

Source: https://habr.com/ru/post/1712901/


All Articles