missing namespace on root element of WCF proxy client
- From: rmgonsalves@xxxxxxxxx
- Date: Thu, 10 Jan 2008 09:17:45 -0800 (PST)
Hi,
I have the following class that is exposed as a webservice method
parameter parameter .
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:schemas.sequel.com/
genericImport")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="urn:schemas.sequel.com/
genericImport", IsNullable=false)]
public partial class Schema {
private Import importField;
/// <remarks/>
public Import Import {
get {
return this.importField;
}
set {
this.importField = value;
}
}
}
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:schemas.sequel.com/
genericImport")]
public partial class Import {
private string recordCountField;
private RecordType recordTypeField;
private bool recordTypeFieldSpecified;
private RecordSource recordSourceField;
private bool recordSourceFieldSpecified;
private Policy[] policysField;
}
have ommited the public properties.
When I use the Add Service Reference funtionality on the client to
generate a proxy the folowing code is generated
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:schemas.sequel.com/
genericImport")]
public partial class Schema
{
private Import importField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=0)]
public Import Import
{
get
{
return this.importField;
}
set
{
this.importField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil",
"3.0.4506.30")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:schemas.sequel.com/
genericImport")]
public partial class Import
{
etc etc
As you can see in the proxy class the Schema type does not have the
System.Xml.Serialization.XmlRootAttribute as a result when i serialize
the object to xml on the client the xml generated is
<Schema have omitted standard xml namespce definitions>
<Import xmlns="urn:schemas.sequel.com/genericImport">
<other elements>
</Schema>
i was expecting the following xml
<Schema xmlns="urn:schemas.sequel.com/genericImport">
<Import >
<other elements>
</Schema>
Also if i want to deserialize an xml file to the object of type schema
on the proxy i need to supply the following xml
<?xml version="1.0">
<Schema >
<Import xmlns="urn:schemas.sequel.com/genericImport">
<other elements>
</Schema>
I was expecting to submit the following xml
<?xml version="1.0">
<Schema xmlns="urn:schemas.sequel.com/genericImport">
<Import >
<other elements>
</Schema>
On the client proxy why is the Schema element loosing the name space.
The original xsd used to generated the classes on the server is
<xs:schema targetNamespace="urn:schemas.sequel.com/genericImport"
elementFormDefault="qualified" attributeFormDefault="qualified"
id="PolicyImport" xmlns="urn:schemas.sequel.com/genericImport"
xmlns:gi="urn:schemas.sequel.com/genericImport" xmlns:xs="http://
www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="SimpleTypes.xsd"/>
<!-- these attributes describe whether the fields are needed for new
or amended data and are only used within this schema-->
<xs:attribute name="mandatoryNew" type="xs:boolean" />
<xs:attribute name="mandatoryAmend" type="xs:boolean" />
<!-- import root element -->
<xs:element name="Schema" type ="gi:Schema" />
<xs:complexType name ="Schema" >
<xs:sequence>
<xs:element name="Import" type="gi:Import" >
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name ="Import">
<xs:sequence>
<xs:element name="RecordCount" type="xs:positiveInteger"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:Schema>
Any help greatly appreciated.
.
- Prev by Date: how to print an XML file directly.........
- Next by Date: [announce] Access HL7 from Microsoft .NET
- Previous by thread: how to print an XML file directly.........
- Next by thread: [announce] Access HL7 from Microsoft .NET
- Index(es):
Relevant Pages
|