C#将控制台应用程序中的值发布到Web服务 [英] C# Post values from a console application to A web service

查看:453
本文介绍了C#将控制台应用程序中的值发布到Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图解决这个问题。我已经能够找到控制台应用程序的示例代码来发布数据,但我对Web服务是全新的。我有一个控制台应用程序进行一些计算,然后我想将这些计算发送到Web服务。有人可以提供一些非常简单的代码,说明在控制台应用程序端的帖子是什么样的,以及Web服务需要接受帖子或者适当的术语是什么。非常感谢任何帮助。

I have been trying to figure this out for a while now. I have been able to find sample code for console application to post data but i''m completely new to web services. I have a console app that does some calculations and i would like to then send those calculations to a web service. Could some one please provide some very simple code as to what the post looks like on the console app side and also what a web service needs to accept the post or whatever the proper term is for it. Any help is greatly appreciated.

推荐答案

看看下面的链接。



http://forums.asp.net/t/1056508.aspx/1



http:/ /stackoverflow.com/questions/8270464/best-way-to-call-a-json-webservice-from-a-net-console



还有更多关于 Google
Have a look at below links.

http://forums.asp.net/t/1056508.aspx/1

http://stackoverflow.com/questions/8270464/best-way-to-call-a-json-webservice-from-a-net-console

And many more on Google.


你无法获得简单代码回应这种模糊的要求。这实际上取决于您想要实现的内容和服务的细节。



但是,有一件事是显而易见的:您的Web服务应用程序为客户端应用程序提供了一些接口。您的控制台应用程序与此类客户端应用程序没有什您的服务可以是基于SOAP或JSON,RESTful与否,基于WCF等。这一切都定义了客户应该做的事情。



有关基本想法,请参阅: http://en.wikipedia.org/wiki/Web_service [ ^ ]。



但最终,了解您将要使用的特定服务消费。



-SA
You cannot get a "simple code" in response to such a vague request. It really depends on the detail of what you want to achieve and your service.

However, one thing is obvious: your Web Service application provides some interface to the client application. Your console application is no different from such client application. Your service can be SOAP or JSON based, RESTful or not, WCF based, and so on. It all defines what the client should do.

For basic ideas, please see: http://en.wikipedia.org/wiki/Web_service[^].

But ultimately, learn about the particular Service you are going to use consume.

—SA


这篇关于C#将控制台应用程序中的值发布到Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆