tags:

views:

769

answers:

1

I have a wcf web service and I need to provide the client with the wsdl files.

Previously I used svcutil on the .dll and everything was fine.

However, recently I implemented the factory to Flaten the wsdl file (re: http://wcfextras.codeplex.com/).

My questions is this: Is there anyway of either using svcutil on the .svc to extract the Flattened .WSDL files or maybe somehow hit up the web service when it is running in the local webdev server to retrieve the .WSDL files?

As far as I'm aware, if I was to navigate to my local web dev server (http://localhost:2916/Service.svc?wsdl) and if i was to view source and saved that as .wsdl that this is wrong and would not provide all the relevant information.

note: See below for how the Factory is used in the .svc file....

<% @ServiceHost Factory="CompanyName.ServiceModel.Extensions.Description.FlatWsdlServiceHostFactory" language=c# Service="CompanyName.WebServices.Service"%>

Thanks, Steven

+3  A: 

Yes, you should still be able to use svcutil to extract the WSDL from your service, even if you have an extension installed that will flatten the WSDL.

To download the metadata document(s) from your running service, use this command:

svcutil /t:metadata http://service/metadataEndpoint

You need to point your URL to the metadata endpoint defined in your config, e.g. the endpoint that's defined to use "mexHttpBinding" or "mexTcpBinding" and the "IMetadataExchange" contract.

If you don't have any metadata exchange endpoints defined, you won't be able to retrieve that information, obviously.

marc_s
Hello Marc, thanks for your help....Quick question, i was able to add the mexHttpBinding and get the wsdl using svcutil /t:metadata Do you know why it would create two files? filename1.wsdl filename.wsdlThe file with the '1' in the name has lots of soap:binding soap:body soap:operation, ext... whereas the file without the '1' in the name really only contains the wsdl and xsd tags.Would i provide both to the client? Thanks again for your assistance. Steven.
stevenrosscampbell
I believe the WCF runtime will generate one WSDL per namespace, if I'm not mistaken. You can flatten the XSD into the WSDL but it seems you cannot "merge" two WSDL parts with different namespaces. And yes, I believe you need both files to work properly (one references the other)
marc_s
Hey MarcThanks again. Good news, the client has decided that they are ready to hit up the web service directly :) No need for me to generate anymore (i did learn alot with your help though)All the best. Steven
stevenrosscampbell