Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.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# 如何比较两个Web服务描述(wsdl)?_C#_.net_Web Services - Fatal编程技术网

C# 如何比较两个Web服务描述(wsdl)?

C# 如何比较两个Web服务描述(wsdl)?,c#,.net,web-services,C#,.net,Web Services,我从Web服务构建一个文件Service.dll,以供使用。现在,我想自动更新文件Service.dll,以了解Web服务更改的时间。当前,我的方法是将用于描述web服务的WSDL保存到Service.dll资源中,然后将此资源中的WSDL与直接从web服务获得的WSDL进行比较,如果它们不同,我将更新文件Service.dll。 这是我的代码C#: 和方法检查wsdl已更改: private static bool IsServiceChanged(Uri uri) {

我从Web服务构建一个文件
Service.dll
,以供使用。现在,我想自动更新文件
Service.dll
,以了解Web服务更改的时间。当前,我的方法是将用于描述web服务的WSDL保存到
Service.dll
资源中,然后将此资源中的WSDL与直接从web服务获得的WSDL进行比较,如果它们不同,我将更新文件Service.dll。 这是我的代码C#:

和方法检查wsdl已更改:

 private static bool IsServiceChanged(Uri uri)
    {
        Assembly assembly = Assembly.LoadFile(@"C:\Users\John\Downloads\Compressed\Core\TestApp\Ref\Service.dll");
        Stream stream = assembly.GetManifestResourceStream("Service.wsdl");

        if (string.IsNullOrEmpty(uri.Query))
        {
            UriBuilder uriBuilder = new UriBuilder(uri);
            uriBuilder.Query = "WSDL";
            uri = uriBuilder.Uri;
        }

        System.Net.WebRequest wsdlWebRequest = System.Net.WebRequest.Create(uri);

        using (Stream wsdlRequestStream = wsdlWebRequest.GetResponse().GetResponseStream())
        using (StreamReader reader = new StreamReader(stream))
        using (StreamReader reader2 = new StreamReader(wsdlRequestStream))
        {
            string result = reader.ReadToEnd();
            string result2 = reader2.ReadToEnd();
            if (string.Compare(result, result2, StringComparison.Ordinal) != 0)
            {
                return true;
            }
        }
        return false;
    }
当前,我的方法
IsServiceChanged(Uri Uri)
始终返回
True
,因为写入文件的文件wsdl更改了排序顺序命名空间。例如:

<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"....

见文章。@AlexanderPetrov感谢您的回复!
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"....
<wsdl:definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:s="http://www.w3.org/2001/XMLSchema"