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?

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

tesicg
  • 3,971
  • 16
  • 62
  • 121

2 Answers2

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 .

Cybermaxs
  • 24,378
  • 8
  • 83
  • 112
  • 1) Ok. I've noticed WSDL on client side and meant it was only there. But it's clear now it's generated on server side and copied to client side in order to create client proxy. Thanks. – tesicg Oct 04 '12 at 08:25
  • 2) We have a project where we get XSD files only from our client. There's no WSDL, there's no WCF service. We should create in memory WSDL based on XSD files and service contract which is fixed: Message CustomAction(Message message). The first question is how to do that? The second question is how to use generated in memory WSDL in order to create WCF service programmatically? If you can help, you can write it as new answer if you need more space. Thank you. – tesicg Oct 04 '12 at 08:29
0

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.

Nick Ryan
  • 2,662
  • 1
  • 17
  • 24
  • Ok. I've understood that. Thanks. Further. We have a project where we get XSD files only from our client. There's no WSDL, there's no WCF service. We should create in memory WSDL based on XSD files and service contract which is fixed: Message CustomAction(Message message). The first question is how to do that? The second question is how to use generated in memory WSDL in order to create WCF service programmatically? If you can help, you can write it as new answer if you need more space. Thank you. – tesicg Oct 04 '12 at 10:03
  • @tesicg. If your client is providing you with XSD files, rather than constructing the WSDL in memory, I'd advise that you construct a concrete WSDL based on the XSDs (rather than doing it in-memory). When you have the WSDL file, then create your proxy based on it (using add service reference). IF you don't want to rely on a add service reference, you could generate contract classes based on the XSD and use them in a hand-crafted proxy class to call the services. This SO article talks about XSD.EXE http://stackoverflow.com/questions/5217665/generate-net-4-0-class-from-xsd – Nick Ryan Oct 04 '12 at 10:27
  • Ok. How to create WSDL based on XSD files? – tesicg Oct 04 '12 at 10:38
  • @tesicg. Thats probably a new question! :) When I've needed to do this, I've used a tool called http://www.oxygenxml.com/. I think it's possible to download a fully functional trial. There is also an SO question here http://stackoverflow.com/questions/920086/generating-a-wsdl-from-a-xsd-file. Basically, the WSDL needs to include the XSD and use the types therein to define the service method contracts. – Nick Ryan Oct 04 '12 at 10:43
  • Thanks Nick. I've already been able to create WSDL from XSD files by using WSCF.blue tool. But, the point is we need to do it programmatically because we'll have a lot of XSD files and if we do it manually it'll take a lot of time. So we need to automate that process. – tesicg Oct 04 '12 at 11:02
  • Can't help you there I'm afraid. – Nick Ryan Oct 04 '12 at 12:57