J
Jay Douglas
I'm attempting to create one continuous xsd type with 2 C# objects, one of
which that inherits from each other. When ASP.net 2.0 serializes either
version of the webservice objects, along with the base object, it says that
these objects have the same type name and need to be in different name
spaces. The problem is, that when different namespaces are used, the XML
required to submit a request needs to detail both namespaces, which is
cumbersome. I would like to use the namespace from just the derived object,
allowing for no namespace declaration on the base class.
I have read many different posts across newsgroups and websites referring to
this issue but still havn't found a solution that fits my requirements. I'm
hoping that somebody can help.
Is there any way to tell the ASP.net 2.0 serializer to basically flatten
these objects into one complex type?
(Supporting Exception and code follows)
Exception:
Types 'ServiceObjects._2_5.Adapters.TestMeBase' and
'ServiceObjects._2_6.TestMe' both use the XML type name, 'TestMe', from
namespace 'http://test/2'. Use XML attributes to specify a unique XML name
and/or namespace for the type.
Web Service Code:
[WebMethod]
public bool TestMethod(ServiceObjects._2_6.TestMe testObj)
{
return true;
}
Base Class:
[XmlType("TestMe")]
public class TestMeBase
{
public string BaseStr;
}
Derived Class:
[XmlType("TestMe", Namespace="http://test/2")]
public class TestMe : ServiceObjects._2_5.Adapters.TestMeBase
{
public string DerivedStr;
}
Thanks for reading through this post:
Jay
which that inherits from each other. When ASP.net 2.0 serializes either
version of the webservice objects, along with the base object, it says that
these objects have the same type name and need to be in different name
spaces. The problem is, that when different namespaces are used, the XML
required to submit a request needs to detail both namespaces, which is
cumbersome. I would like to use the namespace from just the derived object,
allowing for no namespace declaration on the base class.
I have read many different posts across newsgroups and websites referring to
this issue but still havn't found a solution that fits my requirements. I'm
hoping that somebody can help.
Is there any way to tell the ASP.net 2.0 serializer to basically flatten
these objects into one complex type?
(Supporting Exception and code follows)
Exception:
Types 'ServiceObjects._2_5.Adapters.TestMeBase' and
'ServiceObjects._2_6.TestMe' both use the XML type name, 'TestMe', from
namespace 'http://test/2'. Use XML attributes to specify a unique XML name
and/or namespace for the type.
Web Service Code:
[WebMethod]
public bool TestMethod(ServiceObjects._2_6.TestMe testObj)
{
return true;
}
Base Class:
[XmlType("TestMe")]
public class TestMeBase
{
public string BaseStr;
}
Derived Class:
[XmlType("TestMe", Namespace="http://test/2")]
public class TestMe : ServiceObjects._2_5.Adapters.TestMeBase
{
public string DerivedStr;
}
Thanks for reading through this post:
Jay