'System.Xml.Serialization.XmlElementAttribute' does not contain a definition for 'Form'

Hello,

I'm getting the above error message in the generated client code for a web service. The web service is a JAXWS 2.0 and I'm generating the client part with VS 2003. What I found was that the Form property is supported in CF 2.0 but not CF 1.0. I need to use VS 2003 so I'm limited to CF 1.0. How to solve the problem

Thanks



Answer this question

'System.Xml.Serialization.XmlElementAttribute' does not contain a definition for 'Form'

  • IanR

    Hi Andrew,

    The compilation issue is coming as my development setup is Visual Studio.Net 2003 (ie .Net compact framework 1.0)

    The generated code (Reference.cs) has Form attribute which is not supported in .Net CF v1.0.

    [return: System.Xml.Serialization.XmlArrayItemAttribute("result", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Namespace=http://hello.ws.jboss.org/types)]

    In order to get compilation through, I removed these attributes. Now when I try to invoke service the Server (jboss in my case) crips saying, parameters are coming out of order.

    Can I tweak my wsdl to avoid generating these Form tags so my code gets compile straight-forward will appreciate your help to resolve this.

    Do you think migrating to Visual Studio.Net 2005 will help

    ================================

    Attaching the WSDL File for reference

    < xml version="1.0" encoding="utf-8" >

    <definitions xmlns:s1="http://hello.ws.jboss.org/types" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://core.signalcore.org/jaws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://hello.ws.jboss.org/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://hello.ws.jboss.org/" name="HelloService" xmlns="http://schemas.xmlsoap.org/wsdl/">

    <types>

    <s:schema xmlns:tns="http://core.signalcore.org/jaws" xmlns:ns1="http://hello.ws.jboss.org/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://core.signalcore.org/jaws">

    <s:import namespace="http://hello.ws.jboss.org/types" />

    <s:complexType name="Student">

    <s:sequence>

    <s:element minOccurs="0" maxOccurs="unbounded" name="courses" nillable="true" type="s:string" />

    <s:element name="id" type="s:int" />

    <s:element name="name" nillable="true" type="s:string" />

    </s:sequence>

    </s:complexType>

    </s:schema>

    <s:schema xmlns:ns2="http://core.signalcore.org/jaws" xmlns:tns="http://hello.ws.jboss.org/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://hello.ws.jboss.org/types">

    <s:import namespace="http://core.signalcore.org/jaws" />

    <s:complexType name="getStudent">

    <s:sequence />

    </s:complexType>

    <s:complexType name="getStudentList">

    <s:sequence />

    </s:complexType>

    <s:complexType name="getStudentListResponse">

    <s:sequence>

    <s:element minOccurs="0" maxOccurs="unbounded" name="result" nillable="true" type="ns2:Student" />

    </s:sequence>

    </s:complexType>

    <s:complexType name="getStudentResponse">

    <s:sequence>

    <s:element name="result" nillable="true" type="ns2:Student" />

    </s:sequence>

    </s:complexType>

    <s:complexType name="hello">

    <s:sequence>

    <s:element name="String_1" nillable="true" type="s:string" />

    </s:sequence>

    </s:complexType>

    <s:complexType name="helloResponse">

    <s:sequence>

    <s:element name="result" nillable="true" type="s:string" />

    </s:sequence>

    </s:complexType>

    <s:element name="getStudent" type="tns:getStudent" />

    <s:element name="getStudentList" type="tns:getStudentList" />

    <s:element name="getStudentListResponse" type="tns:getStudentListResponse" />

    <s:element name="getStudentResponse" type="tns:getStudentResponse" />

    <s:element name="hello" type="tns:hello" />

    <s:element name="helloResponse" type="tns:helloResponse" />

    </s:schema>

    </types>

    <message name="Hello_getStudentResponse">

    <part name="result" element="s1:getStudentResponse" />

    </message>

    <message name="Hello_hello">

    <part name="parameters" element="s1:hello" />

    </message>

    <message name="Hello_helloResponse">

    <part name="result" element="s1:helloResponse" />

    </message>

    <message name="Hello_getStudent">

    <part name="parameters" element="s1:getStudent" />

    </message>

    <message name="Hello_getStudentListResponse">

    <part name="result" element="s1:getStudentListResponse" />

    </message>

    <message name="Hello_getStudentList">

    <part name="parameters" element="s1:getStudentList" />

    </message>

    <portType name="Hello">

    <operation name="getStudent">

    <input message="tns:Hello_getStudent" />

    <output message="tns:Hello_getStudentResponse" />

    </operation>

    <operation name="getStudentList">

    <input message="tns:Hello_getStudentList" />

    <output message="tns:Hello_getStudentListResponse" />

    </operation>

    <operation name="hello">

    <input message="tns:Hello_hello" />

    <output message="tns:Hello_helloResponse" />

    </operation>

    </portType>

    <binding name="HelloBinding" type="tns:Hello">

    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />

    <operation name="getStudent">

    <soap:operation soapAction="" />

    <input>

    <soap:body use="literal" />

    </input>

    <output>

    <soap:body use="literal" />

    </output>

    </operation>

    <operation name="getStudentList">

    <soap:operation soapAction="" />

    <input>

    <soap:body use="literal" />

    </input>

    <output>

    <soap:body use="literal" />

    </output>

    </operation>

    <operation name="hello">

    <soap:operation soapAction="" />

    <input>

    <soap:body use="literal" />

    </input>

    <output>

    <soap:body use="literal" />

    </output>

    </operation>

    </binding>

    <service name="HelloService">

    <port name="HelloPort" binding="tns:HelloBinding">

    <soap:address location="http://tapesh:8080/jaw/Hello" />

    </port>

    </service>

    </definitions>

    =====================================


  • guile0

    It seems my problem is very rare. I can't find any information about solving it. I also wonder why is the form property in System.Xml.Serialization.XmlElementAttribute generated in the first place. I used the web service address from the quickstart tutorials and there was no form property in the generated client code.

    Any ideas will be appreciated.


  • sureshsundar007

    Pls let me know if u were able to get it through.

    I am facing very similar problem. Trying to get JBOSS web service with .Net compact framework 1.0.

    Did u try upgrading to .net cf version 2.0

    Regards

    Tapesh


  • PRMARJORAM

    What is the XmlElementAttribute.Form property set to before you remove it If it is set to "unqualified", then that's a non-default value and you're essentially changing the schema to get it to compile, and that will break compatibility with your web service. There may be a workaround, but we need to investigate this possibility.

    Can you share the URL of the WSDL for your service so I can try it on my end



  • Francisco6783

    Also when I remove the form property I compile successfully, but the methods return null. I made a client in a .net framework application and there is no such problem. Please help!
  • zppro

    Tapesh K Agarwal wrote:
    [return: System.Xml.Serialization.XmlArrayItemAttribute("result", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Namespace=http://hello.ws.jboss.org/types)]

    In order to get compilation through, I removed these attributes.

    Ok, removing any of those attributes changes the XML that is serialized to the web service and back, which would break compatibility and cause errors like what you are getting. However, let's take these one at a time, as I think you have a least two issues here...

    Tapesh K Agarwal wrote:
    Now when I try to invoke service the Server (jboss in my case) crips saying, parameters are coming out of order.

    Ok, so that's actually the second issue. NetCF does have an issue where class members are serialized in a scrambled order unless an order is explicitly given. NetCF 1.x and 2.0 both have this issue. You can work around this by using the /order switch when you generate your proxy code using wsdl.exe or xsd.exe. This will add C# code to explicitly order the elements and should eliminate this error.

    Tapesh K Agarwal wrote:
    Can I tweak my wsdl to avoid generating these Form tags so my code gets compile straight-forward

    Well, I don't fully understand what XmlSchemaForm.Unqualified does, so I'm not sure how to modify the WSDL to eliminate your need to use it. You have two options here, from what I can tell. First, just regenerate your proxy code with that /order switch (VS2005 does not use the /Order switch internally, so you have to do it yourself at the command line), remove those Form property references and see if your client suddenly works. If it does, you're done. If it doesn't, then that Form property must be significant to the service and you'll have to upgrade to NetCF v2 to interop with the service.

    Tapesh K Agarwal wrote:
    Do you think migrating to Visual Studio.Net 2005 will help

    Only with the Form property. VS2005 doesn't use the /order switch internally either, so you're still going to have to use the command line to generate your proxy code. NetCF v3.5 will not have this ordering issue.



  • oceansis

    I have same problem…

    I have tried:
    VS 2003 (windows application) – works
    VS 2005 (windows application) – works
    VS 2005 (smart device application) – works

    It is just this CF 1.0 and VS 2003, please anyone with suggestion.


    Thanks!


  • 'System.Xml.Serialization.XmlElementAttribute' does not contain a definition for 'Form'