Problema
Al tratar de importar un servicio WCF en MSE construido a partir de Web Service Software Factory (WSSF), se me presento el siguiente error:
An application error occurred in Catalog Service Operation [GetIdFromName]. Error Detail [Exception Information Type[MseDataException] Source[Microsoft.ManagedSolutions.Mse.Catalog.Data] Message[Procedure or function ‘GetIDFromName’ expects parameter ‘@EntityName’, which was not supplied.] StackTrace[ at Microsoft.ManagedSolutions.Mse.Catalog.Data.Entity.GetIdFromName(String entityName, EntityClass entityClass, SqlTransaction transaction, SqlConnection connection) at Microsoft.ManagedSolutions.Mse.Catalog.Module.Business.EntityManager.GetIdFromName(String entityName, EntityClass entityClass, SqlTransaction transaction, SqlConnection connection)]Exception Information Type[SqlException] Source[.Net SqlClient Data Provider] Message[Procedure or function ‘GetIDFromName’ expects parameter ‘@EntityName’, which was not supplied.] StackTrace[ at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.ManagedSolutions.Mse.Catalog.Data.Entity.GetIdFromName(String entityName, EntityClass entityClass, SqlTransaction transaction, SqlConnection connection)]]
Causa
Al parecer el problema es causado por la forma como es serializado el WSDL del servicio.Posibles causas:
- El modelo de serialización con el que se construyo el servicio WCF con WSSF. Ver la primera parte del blog.
- No todos los data contract generados estan definidos completamete y más concretamente les hace falta su correspondiente namespace.
Solución
Verificar que en los data contract generados se encuentre establecido el valor XmlRootAttribute con el Namespace correspondiente al contrato, en caso que no lo posea.
Ejemplo,
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.Xml”, “4.0.30319.233”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“code”)]
[System.Xml.Serialization.XmlTypeAttribute(Namespace=”http://sap.com/xi/FSCM/Global2″)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = “http://sap.com/xi/FSCM/Global2”, IsNullable = true)]
public partial class BusinessScopeID {
Y sabor !!! Podremos importar el servicio en MSE.