[Mono-dev] WCF Deserialization Problem

monoUser cancomert at gmail.com
Mon Oct 31 05:25:22 EDT 2011


I have complied downloaded master mono branch with git then complied it.
The code I have send above did not worked with the complied version of mono
and sent the same exception.

Then I used the newest complied wsdl tool for creating proxy classes and it
is working in my standalone test project with both monos(my complied mono
instance and the stable mono run instance).

(Note:By the way .Net complied complained about some of the Namespace=""
attribute parameters in the generated code because of some of them were on
the  primitive types such as string or int. When I deleted these
Namespace="" parameters code worked properly.)

How ever when I tried to make the same service call at the same machine only
in my test program stands in the project and uses proxy classes as a
reference library I get the exception below.

Secured connection is not required for the web service. That may cause a
problem as I understand from the exception. How can I specify the binding as
unsecured connection??

If you want I can also send the sniffed packet traffic during the working
execution and the unworking execution. 

The Exception:

Test> mono TestWaterML.exe
WaterML Driver Test
Calling Service
Before Service Call
Missing method .ctor in assembly
/opt/mono/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll, type
Mono.Security.Protocol.Tls.CertificateValidationCallback2
Missing method .ctor in assembly
/opt/mono/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll, type
Mono.Security.Protocol.Tls.CertificateValidationCallback2
System.Net.WebException
  at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename
unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke
(System.String method_name, System.Object[] parameters) [0x00000] in
<filename unknown>:0
End of execution
Test> 

The code that I call service:

        [Service(   "WaterML.Service.ReadValues.Name",
                    "WaterML.Service.ReadValues.Description")]
        public void ReadValues(
            [Parameter( "From",
"WaterML.Service.ReadValues.Parameter.From.Name",
                       
"WaterML.Service.ReadValues.Parameter.From.Description")]
                           DateTime from,
             [Parameter("To",
"WaterML.Service.ReadValues.Parameter.To.Name",
                       
"WaterML.Service.ReadValues.Parameter.To.Description")]
                           DateTime to)
        {
                                  
            try
            {
            
            //Time labels must be in YYYY-MM-DD format
                string start_date = String.Format("{0:yyyy-MM-dd}", from);
                string end_date = String.Format("{0:yyyy-MM-dd}", to);
   
                WaterOneFlow client = new WaterOneFlow();
            
                client.Url = ServiceAddress;              
                client.Timeout = 120000;     

           Console.WriteLine("Before Service Call");
           //Call to Web Service for Data
           //TimeSeriesResponseType response = client.GetValuesObject(
           //                                   Location,
           //                                   VariableCode,
           //                                   start_date,
           //                                   end_date,
           //                                   AuthorizationToken);

           client.UnsafeAuthenticatedConnectionSharing = true;
           client.PreAuthenticate = false;

           TimeSeriesResponseType response =
client.GetValuesObject("NWISDV:10109000", "NWISDV:00060/DataType=Average",
"2011-10-18", "2011-10-10", "");
           
                Console.WriteLine("After Service Call");
                Console.WriteLine("Response
{0}",response.timeSeries.values.count);
                Console.WriteLine("WaterML Service Call Completed
Successfully");                
            }
            catch (FaultException ex)
            {
                Console.WriteLine(ex.GetType().FullName);
                Console.WriteLine(ex.StackTrace);     

                throw new KiTDF.NET.InvalidAnswerException();

            }
            catch (EndpointNotFoundException ex)
            {

                Console.WriteLine(ex.GetType().FullName);
                Console.WriteLine(ex.StackTrace);     

                throw new KiTDF.NET.TimeoutException();
            }
            catch (Exception ex) {
                Console.WriteLine(ex.GetType().FullName);
                Console.WriteLine(ex.StackTrace);     
            }


            Console.WriteLine("End of execution");
        }

Thanks in advice

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


More information about the Mono-devel-list mailing list