简体   繁体   English

使用C#中的post消费Web服务

[英]Consume web service using post in c#

Currently I have less information about this, but I will update soon with more details. 目前,我对此的信息较少,但是我将尽快更新以提供更多详细信息。 I have been provided with a web page which provides user name & password option to access a url & return a token value. 我提供了一个网页,其中提供了用户名和密码选项来访问url和返回令牌值。 The form contains that url in action & the method used is POST. 表单包含实际使用的网址,使用的方法是POST。

I have tried general HttpWebRequest methods to access the url, but have been unsuccessful so far. 我尝试了通用的HttpWebRequest方法来访问url,但到目前为止仍未成功。 It gives error "cannot connect to remote server" 它给出错误“无法连接到远程服务器”

The url is like www.somesite.com\\method.php\\level1\\method1\\xml 网址就像www.somesite.com \\ method.php \\ level1 \\ method1 \\ xml

The url confuses me as other links have some extension at the end(I am relatively new to this web service) 该URL令我感到困惑,因为其他链接的末尾都有一些扩展名(我对该Web服务是相对较新的)

I have been told this webservice has been consumed in mobile. 有人告诉我此Web服务已在移动设备中使用。

Can someone please guide me as to how to access a web service in c# using POST method? 有人可以指导我如何使用POST方法在c#中访问Web服务吗?

I apologise for the lack of detailed information 对于缺少详细信息,我深表歉意

First try to understand how the webservice works. 首先,尝试了解Web服务的工作方式。 You can simply create a simple c# rest web service. 您可以简单地创建一个简单的c#rest Web服务。 To return json data , you will need to specify the return data format on specific operation in the web service. 要返回json数据,您将需要在Web服务中的特定操作上指定返回数据格式。 To use mysql for database, you can search for mysql connector for c# on google. 要将mysql用于数据库,您可以在Google上搜索c#的mysql连接器。 You can find libraries to use in your code. 您可以找到在代码中使用的库。 Hope it helps ! 希望能帮助到你 !

http://www.codeproject.com/Articles/201901/CREATE-RESTful-WCF-Service-API-Using-POST-Step-By http://www.codeproject.com/Articles/201901/CREATE-RESTful-WCF-Service-API-Using-POST-Step-By

我可以通过提供代理详细信息进行访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM