Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/331.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
Web services 使用插件调用外部WS_Web Services_Crm - Fatal编程技术网

Web services 使用插件调用外部WS

Web services 使用插件调用外部WS,web-services,crm,Web Services,Crm,我需要调用一个外部webapi Think get方法和一个插件 我正在使用dynamics on premise,插件已在沙盒中注册。但我遇到了一个错误:无法连接到远程服务器 示例代码: var uri = new Uri("http:......../api/v1/contact"); var request = WebRequest.Create(uri); request.Method = WebRequestMethods.Http.Get; request

我需要调用一个外部webapi Think get方法和一个插件

我正在使用dynamics on premise,插件已在沙盒中注册。但我遇到了一个错误:无法连接到远程服务器

示例代码:


var uri = new Uri("http:......../api/v1/contact");

var request = WebRequest.Create(uri);

request.Method = WebRequestMethods.Http.Get;

request.Timeout = 20000;

request.Headers.Add("DENTITY:{login:login1,password:pass1}");

request.ContentType = "application/json";
try
{

string helloWorldString = "";

using (var response = request.GetResponse())
{

using (var reader = new StreamReader(response.GetResponseStream()))
{

string tmp = reader.ReadToEnd();
helloWorldString = JsonConvert.DeserializeObject<string>(tmp);
Debug.Print("I read this string {0}: ", helloWorldString);
}
}

}
catch (Exception ex)
{
throw;
}


var uri=新uri(“http:../api/v1/contact”);
var request=WebRequest.Create(uri);
request.Method=WebRequestMethods.Http.Get;
请求超时=20000;
Add(“DENTITY:{login:login1,密码:pass1}”);
request.ContentType=“application/json”;
尝试
{
字符串helloWorldString=“”;
使用(var response=request.GetResponse())
{
使用(var reader=newstreamreader(response.GetResponseStream())
{
字符串tmp=reader.ReadToEnd();
helloWorldString=JsonConvert.DeserializeObject(tmp);
Print(“我读取了这个字符串{0}:”,helloWorldString);
}
}
}
捕获(例外情况除外)
{
投掷;
}