wcf serialization xamarin.ios

Monotouch 4.0.6: Error de serialización con los servicios de WCF



serialization xamarin.ios (0)

Estoy ejecutando Mono 2.10 y acabo de actualizar a Monotouch 4.0 .

Se produjo un error en mi aplicación:

System.NullReferenceException: Object reference not set to an instance of an object at System.ServiceModel.Dispatcher.BaseMessagesFormatter.DeserializeReply (System.ServiceModel.Channels.Message message, System.Object[] parameters) [0x000e3] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs:281 at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply (System.ServiceModel.Channels.Message message, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs:89 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x001cb] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:552 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00038] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:482 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:462

¿Que esta pasando? Gracias.

PD: con la versión anterior de MT (3.2.6), el código funcionaba perfectamente.

ACTUALIZACIÓN 1:

He recompilado la aplicación. Ahora la excepción es la siguiente:

System.Net.WebException: There was an error on processing web request: Status code 400(BadRequest): Bad Request at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.WaitEnd () [0x0003b] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:435 at System.ServiceModel.Channels.HttpRequestChannel.EndRequest (IAsyncResult result) [0x00029] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:289 at System.ServiceModel.Channels.HttpRequestChannel.Request (System.ServiceModel.Channels.Message message, TimeSpan timeout) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:63 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:562 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x00066] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:517

ACTUALIZACIÓN 2:

Estoy ejecutando mono versión 2.10.5 y MT 4.0.6. Estoy usando WCF y trato de llamar a un servicio web externo.

Uso el siguiente fragmento de código para llamar al WS:

CustomBinding custom = new CustomBinding(new BinaryMessageEncodingBindingElement(), new HttpTransportBindingElement() { MaxReceivedMessageSize = 2147483647, MaxBufferSize = 2147483647 } ); EndpointAddress endpoint = new EndpointAddress(myUrl); client = new MyServiceClient(custom, endpoint);

Esta excepción está atrapada:

System.Net.WebException: There was an error on processing web request: Status code 400(BadRequest): Bad Request at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.WaitEnd () [0x0003b] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:435 at System.ServiceModel.Channels.HttpRequestChannel.EndRequest (IAsyncResult result) [0x00029] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:289 at System.ServiceModel.Channels.HttpRequestChannel.Request (System.ServiceModel.Channels.Message message, TimeSpan timeout) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:63 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:562 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x00066] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:517 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00038] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:482 at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:462

Si uso basicHttpBinding, no pasa nada. El mensaje parece estar perdido en la red.

client = new MyServiceClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(myUrl + "/basic"));

La estructura devuelta por el WS contiene una lista de elementos de MyClass. La clase MyClass ha sido etiquetada con [atributo DataContract] y miembros con el atributo [DataMember]. Si el servicio solo devuelve cadenas, int o enums, el resultado es correcto.

NOTA: Usando la versión mono 2.10 y MT 3.2.6, la WS funciona en ambas situaciones.

¿Alguna sugerencia? Gracias de antemano.