Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#rest客户端示例_C#_Web Services_Rest - Fatal编程技术网

c#rest客户端示例

c#rest客户端示例,c#,web-services,rest,C#,Web Services,Rest,你好 我是RESTAPI新手,仅使用SOAP(使用自动生成的VisualStudioSOAP代理客户端) 现在我有了一个带有REST请求的外部系统 在本文档中,他们说-处理REST请求的服务器转到-http:///ws. 以及位于“http://server\u uri:port/WSserver/ws”的所有服务地址 因此,我编写了简单的代码: string uri = "http:/localhost:8000/WSserver/ws/newsession"; HttpWebReque

你好

我是RESTAPI新手,仅使用SOAP(使用自动生成的VisualStudioSOAP代理客户端)

现在我有了一个带有REST请求的外部系统

在本文档中,他们说-处理REST请求的服务器转到-http:///ws.

以及位于“http://server\u uri:port/WSserver/ws”的所有服务地址

因此,我编写了简单的代码:

 string uri = "http:/localhost:8000/WSserver/ws/newsession";
  HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
        req.KeepAlive = false;
        req.ContentLength = 0;
        req.ContentType = "text/xml";

        Stream data = req.GetRequestStream();
        data.Close();
但是我得到的URL地址错误的URLFormatException无法解析权限/主机。 那么,如何使用简单的请求呢? 你能举几个例子吗? 谢谢大家!

该协议有输入错误。“http:/localhost”缺少第二个“/”,应为

http://localhost

可能会更改与URLFormatException相关的标题,以便其他人可以搜索。这确实提供了一个答案,因为这是问题的解决方案。