Beginner
Beginner

Reputation: 29583

how to call a web service function form a different server?

I have a web service with a import function i want to call from a c# application on another server

how do i call it

I can go to this url to invoke it:

http://site.co.uk/bespoke/WebService.asmx/Import

i want to call it from within my service on start:

protected override void OnStart(string[] args)
    {
       //What do i do in here?
    }

Upvotes: 0

Views: 190

Answers (1)

Dmytro Shevchenko
Dmytro Shevchenko

Reputation: 34671

You should use the Add Service Reference feature.

Your web service seems to be a SOAP service. So if you wanted to call it "manually" (without any SOAP client libraries), you would have to manually implement the protocol-level stuff (such as XML-based SOAP envelope). This is highly discouraged.

If you use the feature I mentioned above, then Visual Studio will generate classes and objects for you, so you will be able to call the web service's method via a method on a local stub class.

Upvotes: 1

Related Questions