Can you combine the WSDL and XSD data from a WCF service?
Is it possible to create a single file to generate a client from a WCF generated WSDL file (and any additional XSD files that are also generated from this service)
I can generate a valid client using svcut开发者_如何学Pythonil.exe passing both the wsdl file and each xsd file, but I have a customer who is using a PHP tool to generate this and I wanted to see if I could make it easy for them by having only one file instead of many.
Yes, you can - with some clever WCF extensions. Check out these ready-made solutions:
- Flatten your WSDL with this Custom ServiceHost for WCF
- Improving WCF Interoperability: Flattening your WSDL
- Flatten WCF WSDL on demand
- Inline XSD in WSDL for WCF
Hope that helps!
Marc
It's possible.
The WSDL types element can contain multiple schema elements (each with its own namespace), this means that types element from an imported WSDL/XSD can be put in the root document's types element under a schema element that represents the same namespace. Other WSDL elements (message, portType, binding & service) use the root definitions element namespace, so these imported elements from different namespaces cannot remain under different namespaces when put in the same document.
Note however that only the types namespaces are used for the construction of SOAP messages, so changing the namespace of these other elements (if necessary) will not affect the generated SOAP messages.
精彩评论