BizTalk WCF-SQL Adapter Error: Retrieval of Operation Metadata has failed while building WSDL at TypedProcedure – Invalid Object name

Following yesterday’s blog post, on the same note, when we tried to generate a WCF-SQL stored procedure schema for a new BizTalk Server solution, we got the following error inside Visual Studio:

Error while retrieving or generating the WSDL. Adapter message: Retrieval of Operation Metadata has failed while building WSDL at ‘TypedProcedure/dbo/<stored-procedure-name>’

Once again, this is quite a generic error, and to gain more insight, you need to click on Details.

Microsoft.ServiceModel.Channels.Common.MetadataException: Retrieval of Operation Metadata has failed while building WSDL at ‘TypedProcedure/dbo/<stored-procedure-name>’ —> System.Data.SqlClient.SqlException: Invalid object name ‘table-name.column-name’.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

Cause

This error normally tells you that something is broken inside your stored procedure. In other words, your stored procedure is not working properly, and it gives an error while you execute it.

In my case, the stored procedure was doing an inner join with a table that belonged to another database, and someone forgot to reference that database, something like [database-name].[table-name].[column-name].

Solution

Solving this issue is quite simple:

  • Open SQL Server Management Studio (SSMS) and execute the stored procedure you want to use to generate the schema.
  • Check what the error is on the output window and fix it..
  • Repeat this process until you are able to successfully execute the stored procedure.

After doing that, I was able to successfully generate the SQL schema for that stored procedure.

Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can buy (or help me buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top