且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不添加引用的情况下从客户端应用程序调用Web服务?

更新时间:2022-11-03 15:13:31

也许这会让你入门:

如何:创建Windows Communication Foundation客户端 [ ^ ]

Web服务 - 在客户端应用程序中创建WCF端点配置,代码? - Stack Overflow [ ^ ]

如何在不设计服务参考的情况下调用服务时间 [ ^ ]



我认为服务模型元数据实用工具( SvcUtil.exe )应该能够为客户端使用生成配置文件。


当WCF服务通过基本HTTP绑定公开HTTP端点时,它遵循作为SOAP Web服务的传统SOAP约定,并将SOAP信封作为HTTP请求有效负载排除。如果您不想预先创建客户端代理并仍想调用请求,则需要以编程方式创建SOAP信封并使用任何HTTP客户端(例如System.Net.WebClient)调用HTTP请求。 BLOCKQUOTE>

I just know the serveice url and method name.
url:- http://localhost:51507/Service.svc"
name : GetMessage();

What I have tried:

without adding service reference in client application

Maybe this will get you started:
How to: Create a Windows Communication Foundation Client[^]
web services - Create WCF endpoint configurations in the client app, in code? - Stack Overflow[^]
How to call a service without adding service reference at design time[^]

I think the Service Model Metadata Utility Tool (SvcUtil.exe) should be able to generate a configuration file for client use.


When a WCF service exposes HTTP endpoints through basic HTTP bindings, it follows the classical SOAP convention of being SOAP web service, and excepts a SOAP envelope as HTTP request payload. If you don't want to pre-create client proxies and still want to invoke the request, you need to programmatically create the SOAP envelope and invoke an HTTP request using any of the HTTP client(e.g. System.Net.WebClient).