惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
大猫的无限游戏
大猫的无限游戏
S
Securelist
The Hacker News
The Hacker News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Fortinet All Blogs
Jina AI
Jina AI
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
Stack Overflow Blog
Stack Overflow Blog
Webroot Blog
Webroot Blog
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
量子位
S
Schneier on Security
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
O
OpenAI News
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
博客园 - 叶小钗
L
LINUX DO - 最新话题
V
Visual Studio Blog
U
Unit 42
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Security Affairs
AWS News Blog
AWS News Blog
S
Secure Thoughts
腾讯CDC
Cloudbric
Cloudbric
H
Help Net Security
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
C
Cyber Attacks, Cyber Crime and Cyber Security
WordPress大学
WordPress大学
The Last Watchdog
The Last Watchdog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 【当耐特】
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
D
DataBreaches.Net
A
About on SuperTechFans
G
GRAHAM CLULEY
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Martin Fowler
Martin Fowler
Vercel News
Vercel News
Cisco Talos Blog
Cisco Talos Blog
NISL@THU
NISL@THU
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary

博客园 - 孤城浪子

[转].Net 中的许可证机制 [原]一步一步自己制作弹出框 [转]获取窗口 高 、宽 的JS代码 PHP连接mysql数据库 - 孤城浪子 - 博客园 PHP文件上传 [转]ASP.NET 2.0 下加密解密算法的封装 [转]fckeidtor配置 [转]加解密技术 - 孤城浪子 - 博客园 [转]服务器推技术 [JavaScript]简单跟随鼠标移动的文字 排序算法 [仿照CloudGamer]写的颜色渐变 Asp.Net用SmtpClient发送邮件 项目中遇到的Vss和Sql问题 [JavaScript]拖动对象 - 孤城浪子 - 博客园 [JavaScript]飘浮文字 C#文件打散合并 C#调用Excel的宏 [网上整理]C#合并Excel
动态调用Web Service - 孤城浪子 - 博客园
孤城浪子 · 2010-01-05 · via 博客园 - 孤城浪子

代码

 System.Net.WebClient wc = new System.Net.WebClient();
        System.IO.Stream stream 
= wc.OpenRead("http://localhost:44763/Jquery/DynamicInvoke.asmx?WSDL");
        
//获取Web服务描述
        System.Web.Services.Description.ServiceDescription sd =System.Web.Services.Description.ServiceDescription.Read(stream);
        System.Web.Services.Description.ServiceDescriptionImporter sdi 
= new System.Web.Services.Description.ServiceDescriptionImporter();
        sdi.AddServiceDescription(sd, 
"""");
        System.CodeDom.CodeNamespace ns 
= new System.CodeDom.CodeNamespace();
        System.CodeDom.CodeCompileUnit cu 
= new System.CodeDom.CodeCompileUnit();
        cu.Namespaces.Add(ns);
        sdi.Import(ns, cu);
//导入指定的web服务描述
        
//创建csharp代码提供程序
        Microsoft.CSharp.CSharpCodeProvider provider = new Microsoft.CSharp.CSharpCodeProvider();
        
//创建csharp代码编译器
        System.CodeDom.Compiler.ICodeCompiler compiler = provider.CreateCompiler();//调用参数设置
        System.CodeDom.Compiler.CompilerParameters parms = new System.CodeDom.Compiler.CompilerParameters();
        parms.GenerateExecutable 
= false;
        parms.GenerateInMemory 
= true;

        parms.ReferencedAssemblies.Add(

"System.dll");
        parms.ReferencedAssemblies.Add(
"System.XML.dll");
        parms.ReferencedAssemblies.Add(
"System.Web.Services.dll");
        parms.ReferencedAssemblies.Add(
"System.Data.dll");//生成程序集
        System.CodeDom.Compiler.CompilerResults result = provider.CompileAssemblyFromDom(parms, cu);
        
if (true == result.Errors.HasErrors)
        {
 
        }

        System.Reflection.Assembly assembly 

= result.CompiledAssembly;
        Type t 
= assembly.GetType("DynamicInvoke"truetrue);
        
object obj = Activator.CreateInstance(t);
        System.Reflection.MethodInfo mi 
= t.GetMethod("HelloWorld");
        Response.Write(mi.Invoke(obj, 
null));