BizTalk Generated WebService has wrong schema in WSDL
Ok there are some entries about this on GOOGLE but I just thought I should share this again….
You have a XSD and you have created orchestrations ‘n stuff. And finally you decide to run the “BizTalk Web Services Publishing Wizard”. It will generate a nice webservice and everything LOOKS fine.
In my current project somebody complained about the XSD-Schema contained in the WSDL beeing different from the XSD-Schema he initially got. Since I used that schema without any modifications I started to look at the WSDL more closely….
And what I saw was something I didn’t like…. The guy who was complaining was right. The “BizTalk Web Services Publishing Wizard” did publish a different schema…
Not really big differences but MinOccurs and MaxOccurs where completely mixed up. Then I went to Google and found the following.
When you run the Wizard, he generates a file that is initially not included in the project. The name of this file is : WsdlExtension.cs.
Once this file is included, you see some comments on the top. These comments describe the steps nessecary to generated a WSDL that reflects the XSD correct. Below is an example of this…..
// SOAP Extension Reflector for customizing WSDL.
//
// To use,
// 1. Add this file to the Web Service project.
// 2. To enable WSDL customization,
// Add the following to the Web.config file under the /configuration/system.web/webServices node.
// <soapExtensionReflectorTypes>
// <add type=”XXX_Proxy.WsdlExtension, XXX_Proxy” />
// </soapExtensionReflectorTypes>
// 3. Rebuild the Web Service project.
// 4. Create a xsd folder in the web service’s virtual directory.
// 5. Add .xsd files for schemas to replace in the generated WSDL.
//
// Schema replacement in the WSDL is done as follows:
// For each .xsd file in the xsd folder,
// if the target namespace of of .xsd file schema matches the target namespace of a schema in the WSDL,
// the schema in the WSDL is replaced with the .xsd file schema.
//
// References:
// 1. <soapExtensionReflectorTypes> Element
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfsoapextensionreflectortypes.asp
// 2. Extend the ASP.NET WebMethod Framework by Adding XML Schema Validation
// http://msdn.microsoft.com/msdnmag/issues/03/07/XMLSchemaValidation/default.aspx
//
On my biztalk 2006 machine everything is generated. And everything is there so i really don’t know what your problem could be. But maybe your installation isn’t all that.. ( maybe it got corrupt )