[Mono-dev] WCF Deserialization Problem

monoUser cancomert at gmail.com
Thu Oct 27 06:11:45 EDT 2011


The problem is probably same as the bugzilla.
As far as I understand from the bug fix Form=XmlSchemaForm.Unqualified must
be declared in XmlAttribute and XmlElement attributes on the classes and the
properties.

So that I edited generated code XmlAttributeAttribute and
XmlElementAttribute as
[System.Xml.Serialization.XmlAttributeAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified
,....)]
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified
,.....)]

I both tried Form=System.Xml.Schema.XmlSchemaForm.Unqualified and
Form=System.Xml.Schema.XmlSchemaForm.None
But it still don't work under my mono instance.

When parameters are "" that means I want all the data so the parameters and
all other thinks are okay and it is working under .Net

When I use a channel factory approach to fetch data
 BasicHttpBinding binding = new BasicHttpBinding();
 binding.MaxBufferSize = int.MaxValue;
 binding.MaxReceivedMessageSize = int.MaxValue;
 binding.CloseTimeout = TimeSpan.FromMinutes(1);
EndpointAddress endpoint = new
EndpointAddress("http://his09.umbc.edu/BaltGW/cuahsi_1_0.asmx");
//http://river.sdsc.edu/wateroneflow/NWIS/DailyValues.asmx");


ChannelFactory<WaterOneFlow.WaterOneFlow> channel_factory = new
ChannelFactory<WaterOneFlow.WaterOneFlow>(binding, endpoint);
WaterOneFlow.WaterOneFlow client = channel_factory.CreateChannel();
GetVariableInfoObjectResponse response = client.GetVariableInfoObject(
                    new GetVariableInfoObjectRequest("", "")
);

I get an exception as before
System.NullReferenceException
Object reference not set to an instance of an object
  at System.Xml.Serialization.XmlAttributes..ctor (ICustomAttributeProvider
provider) [0x00000] in <filename unknown>:0
  at
System.ServiceModel.Dispatcher.XmlMessagesFormatter.CreateReflectionMember
(System.ServiceModel.Description.MessagePartDescription partDesc, Boolean
isReturnValue) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Dispatcher.XmlMessagesFormatter.GetSerializer
(System.ServiceModel.Description.MessageBodyDescription desc) [0x00000] in
<filename unknown>:0
  at System.ServiceModel.Dispatcher.XmlMessagesFormatter.PartsToMessage
(System.ServiceModel.Description.MessageDescription md,
System.ServiceModel.Channels.MessageVersion version, System.String action,
System.Object[] parts) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Dispatcher.BaseMessagesFormatter.SerializeRequest
(System.ServiceModel.Channels.MessageVersion version, System.Object[]
parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.CreateRequest
(System.ServiceModel.Dispatcher.ClientOperation op, System.Object[]
parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request
(System.ServiceModel.Description.OperationDescription od, System.Object[]
parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess
(System.Reflection.MethodBase method, System.String operationName,
System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process
(System.Reflection.MethodBase method, System.String operationName,
System.Object[] parameters) [0x00000] in <filename unknown>:0

When I tried fetch data by generated client class , It is only returning a
null pointer to back.


WaterOneFlowClient cl = new WaterOneFlowClient(binding,endpoint);
VariablesResponseType rsp= cl.GetVariableInfoObject("","");

Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object
  at winWaterMLTest.Program.Main (System.String[] args) [0x00000] in
<filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object
reference not set to an instance of an object
  at winWaterMLTest.Program.Main (System.String[] args) [0x00000] in
<filename unknown>:0


Where and how can I find the fixed versions of the mono runtime or code
generator??

Thanks in advice


--
View this message in context: http://mono.1490590.n4.nabble.com/WCF-Deserialization-Problem-tp3937166p3943848.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list