Wednesday, July 25, 2012

Error importing WSDL file into BizTalk solution

Today I was importing a WSDL file provided by a third party web service into a Visual Studio BizTalk solution using the "Metadata Files" option in the BizTalk WCF Service Consuming Wizard and ran into the following error:

"Unable to add metadata file ... (System.InvalidOperationException) There is an error in XML document (1, 40). (System.Xml.XmlException) Name cannot begine with the '.' character, hexadecimal value 0x00. Line 1, position 40."



I opened the file and took a look at line 1, position 40: looked perfectly fine to me. The only thing I noticed when I opened the file was that the file's encoding property (in the Visual Studio properties window) changed when the file was opened in Visual Studio: from Unicode, to UTF-8 (consistent with the encoding specified in the xml declaration).

I saved the modified file and re-ran the BizTalk WCF Service Consuming Wizard, and the file imported fine. I then re-ran the Wizard again with the original file, and the same error occurred. I also tried the wizard using the "Metadata Exchange" option (to browse directly to the live WSDL) and encountered the same error.

I can only conclude that the original WSDL file was generated in the Unicode encoding, which the BizTalk WCF Service Consuming Wizard didn't like, presumably as it wasn't consistent with the encoding specified in the XML declaration.

Anyway, hope this might help someone out there.

No comments:

Post a Comment