How to use existing in memory WSDL in order to create WCF service?

巧了我就是萌 提交于 2019-12-13 01:29:37

问题


1) I know that WSDL file is generated on client side when we want to use existing WCF service. This is in case we use "Add Service Reference..." option in Visual Studio. What I don't understand is - at what moment exactly WSDL file is used when we use the client proxy to invoke WCF service?

2) I don't know how to use or connect or attach existing in memory WSDL in the process of creation WCF service. I mean what should I write? Something like:

Uri mexAddress = new Uri("http://localhost:2240/Service1.svc?wsdl");

or:

Uri mexAddress = new Uri("http://localhost:2240/Service1.svc?" + SomeName.wsdl);

or:

?

Thank you in advance.

Goran


回答1:


1) I know that WSDL file is generated on client side when we want to use existing WCF service. This is in case we use "Add Service Reference..." option in Visual Studio. What I don't understand is - at what moment exactly WSDL file is used when we use the client proxy to invoke WCF service?

No, the wsdl is generated at server-side. It is the XML based document that describes a Service. It specifies the location of the service and the operation or methods the service exposes. When adding a service reference, Visual Studio (or svcutil) save a copy of this wsdl only for generating a client proxy. The wsdl will never be used after that generation and is not embedded in ressources. You can also create a client proxy without a wsdl.

2) I don't know how to use or connect or attach existing in memory WSDL in the process of creation WCF service. I mean what should I write?

Unclear. What do you mean ? On server-side, WCF will automatically manage the WSDL creation (it is also extensible) when you activate the expostion of metadata .




回答2:


The WSDL is not used on the client side at run-time to invoke the service. It is only used at design time to generate the client side proxy code to call the service.



来源:https://stackoverflow.com/questions/12721816/how-to-use-existing-in-memory-wsdl-in-order-to-create-wcf-service

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!