A
ArunDhaJ
Hi,
I'm using WebServices and Serializations in my project. In which I
need a few clarification.
I wanted to know how to perform serialization/de-serialization using
interface classes?
I'll brief my scenario;
The following is a webservice interface
MyClassA MyMethodA(MyClassB classB);
In the above interface, i use two classes MyClassA and MyClassB, they
are defined in WSDL.
public MyClassA
{
public int memberAA;
public int memberAB;
}
public MyClassB
{
public int memberBA;
public int memberBB;
}
When building the WebService consumer the classes are even created in
my client side using wsdl.exe utility. And I'm consuming the
webservice without any hassle and my life's good.
My trouble starts here;
Say, I have yet another interface
string GetMyClassA();
the responded string is the serialized from of MyClassA class. Still,
I would not have faced the problem if the xml format is of form:
<MyClassA memberAA="" memberAB="" />
Because, if the xml is of the above format, I would have used the
MyClassA type to deserialize the xml to MyClassA class. But the xml is
some thing as (contracted form of long names):
<a mAA="" mAB="" />
since the elements and attributes name are contracted form, I'm forced
to create yet another class with my own custom XmlAttributes set as
[XmlRoot(ElementName = "a")]
public ClientMyClassA
{
[XmlAttribute(AttributeName = "mAA")]
public int memberAA;
[XmlAttribute(AttributeName = "mAB")]
public int memberAB;
}
This makes my life so complex that, when ever there is a change in xml
format or interfaces, i need to search for this class and update it
accordingly.....
So, I wanted to know if there are any possibilities to combine the
webservice interfaces classes with the XmlAttributes set to it.
I'm pretty new to WebServices, so I'm struggling to search a solution
in internet. Any help would be much appreciated.
Regards
ArunDhaJ
I'm using WebServices and Serializations in my project. In which I
need a few clarification.
I wanted to know how to perform serialization/de-serialization using
interface classes?
I'll brief my scenario;
The following is a webservice interface
MyClassA MyMethodA(MyClassB classB);
In the above interface, i use two classes MyClassA and MyClassB, they
are defined in WSDL.
public MyClassA
{
public int memberAA;
public int memberAB;
}
public MyClassB
{
public int memberBA;
public int memberBB;
}
When building the WebService consumer the classes are even created in
my client side using wsdl.exe utility. And I'm consuming the
webservice without any hassle and my life's good.
My trouble starts here;
Say, I have yet another interface
string GetMyClassA();
the responded string is the serialized from of MyClassA class. Still,
I would not have faced the problem if the xml format is of form:
<MyClassA memberAA="" memberAB="" />
Because, if the xml is of the above format, I would have used the
MyClassA type to deserialize the xml to MyClassA class. But the xml is
some thing as (contracted form of long names):
<a mAA="" mAB="" />
since the elements and attributes name are contracted form, I'm forced
to create yet another class with my own custom XmlAttributes set as
[XmlRoot(ElementName = "a")]
public ClientMyClassA
{
[XmlAttribute(AttributeName = "mAA")]
public int memberAA;
[XmlAttribute(AttributeName = "mAB")]
public int memberAB;
}
This makes my life so complex that, when ever there is a change in xml
format or interfaces, i need to search for this class and update it
accordingly.....
So, I wanted to know if there are any possibilities to combine the
webservice interfaces classes with the XmlAttributes set to it.
I'm pretty new to WebServices, so I'm struggling to search a solution
in internet. Any help would be much appreciated.
Regards
ArunDhaJ