views:

6508

answers:

4

Hi, I'm troubling into an issue... I'm trying to find a way to generate a single wsdl document from my WCF service, i.e. without any link to external documents. I've used FlatWsdl to remove all xsd:import links, bou my generated wsdl still contains a link to an external wsdl document via a wsdl:import declaration:

<wsdl:import namespace="http://myurl/mynamespace"  
             location="http://myserver/myservice.svc?wsdl=wsdl0"/&gt;

This document actually contains all inlined xsd schemas, so... there's a way to inline also this external wsdl document, in order to have a single wsdl?

Thanks a lot for any kind of help.

+1  A: 

You need to add some extra behaviours etc.

See these articles here:

http://my-tech-talk.blogspot.com/2008/07/adding-flatwsdl-to-wcf-webservice.html

http://blogs.thinktecture.com/cweyer/archive/2007/05/10/414840.aspx

There are several different ways of achieving this.

Marc

marc_s
I've used FlatWsdl, but this flattening only xsd:import and not wsdl:import... maybe I've made a mistake, but looking at the code only XSD are changed :(
D_Guidi
Ahem....yes, you're right. Check out WCFExtras - seems to work just fine for all you want!
marc_s
+2  A: 

(EDIT: Previous answer about FlatWSDL deleted, because as you pointed out it was about eliminating xsd:import not wsdl:import.)

Look at this blogpost: Control generated WSDL in WCF

"... There is always one WSDL generated for one target namespace URI ..."

Do you have different namespace for ServiceContract, DataContract, ServiceBehavior, etc. ?

Vizu
You can also add this as a behavior to a service using the standard service host factory - see my links.
marc_s
I've used FlatWsdl, but this flattening only xsd:import and not wsdl:import... maybe I've made a mistake, but looking at the code only XSD are changed :(
D_Guidi
Oops, you're right, sorry. I edit my answer.
Vizu
thanks for this reply, maybe here is my problem...
D_Guidi
+3  A: 

You could also use the WCFExtras project it has an extension to create a single WSDL-file.

WCFExtras

A collection of useful WCF extensions including Soap Header support, WSDL documentation and more.

The WCF platform is very extensible and allows you to easily add features that are not part of the core product. This project contains some extensions I needed in a WCF based project:

  • SOAP Header support for WCF Adding WSDL
  • Documentation from Source Code XML Comments
  • Override SOAP Address Location URL
  • Single WSDL file for better compatibility with older SOAP tools.

http://wcfextras.codeplex.com/

Jochen
I've take a look at WCFExtras, but from my investigations (maybe I'm wrong) the feature "Single WSDL file" inlines XSD's but not external WSDL's... maybe my problem is here: "... There is always one WSDL generated for one target namespace URI ..." as suggested from Vizu
D_Guidi
A: 

my problem was in endpoint definitions, that are in tempuri.org namespace adding bindingNamespace to endpoint declarations fix my problem. thanks to all for help :)

D_Guidi
If it was my answer that led you to the solution then please mark it as accepted ;-)
Vizu
mark as accepted, and thanks :)
D_Guidi