开发者

How to call Webservice from Windows Service?

How to call Webservice from Windows Service?

I am having one webservice on my Webserver.

I have a windows-service to trigger that webservice.

So I just want to integrate and call my webservice from my windows service.

How can I do that?

EDIT:

TempWindowService is name of my windows application

MyServ is the name of my reference of my webservice.

 TempWindowService.MyServ newService = new TempWindowService.MyServ();
 newService.BatchProcess();

Here BatchProcess() is the webmethod under my webservice.

I get error on line

 TempWindowService.MyServ newService = new TempWindowService.MyServ();

Error is as below

 'TempWindowService.MyServ' is a 'namespace' but is used like a 'type'  

ANSWER:

For Th开发者_StackOverflow中文版ose Who are interested in solution to this question, this is the code to be written

TempWindowService.MyServ.MyServSoapClient newService = new TempWindowService.MyServ.MyServSoapClient();

Hope this Helps everyone looking for a solution to this question. :)


You'd call it just like you would from any application, web or otherwise. In Visual Studio, add a Service Reference for the web service in question to the project for the Windows Service. This will generate proxy classes for you which you would use in your code to access the web service.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜