[MonoTouch] Web service reference.cs return types changed

Bo Kingo Damgaard bo at flex-it.dk
Wed Dec 7 08:43:27 EST 2011


Hi

I have a monotouch project that is 4 month old, and when I used it then,
everything was fine. Today I opened the project because I had to change the
web service reference. I deleted the old one and added the new. Now it seems
that the "model" for using the web service has changed and is not consistent
with that of MonoDroid (I reuse the library there too).
I have a WS function called GetAllData and when fetching data I use the
async method EndGetAllData which now returns a
GetAllDataResponseGetAllDataResult class instead of XmlNode as previously.
The GetAllDataResponseGetAllDataResult class contains a Any property of type
XmlNode. 
I thought I could just use compiler directives to solve this, but I get an
exception

"Unhandled Exception: System.InvalidOperationException: There was an error
reflecting type
'CityShopping.Shared.CSWebservice.GetAllDataResponseGetAllDataResult'. --->
System.InvalidOperationException: There was an error reflecting field 'Any'.
---> System.InvalidOperationException: The element Any has been attributed
with an XmlAnyElementAttribute and a namespace '', but no name. When a
namespace is supplied, a name is also required. Supply a name or remove the
namespace."

which is due to the fact that the namespace is not specified in the
XmlAnyElement in the type:

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml",
"4.0.30319.1")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
   
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://cityshopping.dk/")]
    public partial class GetAllDataResponseGetAllDataResult {
        
        /// <remarks/>
        [System.Xml.Serialization.XmlAnyElement(Namespace="")]
        [System.Xml.Serialization.XmlTextAttribute()]
        public System.Xml.XmlNode Any;
    }

Why has this changed? MonoDroid still only return XmlNode, which is fine
What to do?

/Bo 

--
View this message in context: http://monotouch.2284126.n4.nabble.com/Web-service-reference-cs-return-types-changed-tp4168985p4168985.html
Sent from the MonoTouch mailing list archive at Nabble.com.


More information about the MonoTouch mailing list