Hi All,
I am working on developing a web service that returns an array list. Apart from SOAP, I had to enable HTTP POST and GET also.
Initially the web service was returning the ArrayList as ArrayOfAnyType and the individual items as <anyType />. I was able to solve this problem using
the [return :XmlElement(typeof(Data))] attribute
But this method doesn't work for HTTP POST / GET. I searched through the entire web for a solution to this, but it was in vain.
A lot of people have posted this question, but no answers. It would be of great help not only to me, but a bunch of other people, if
somebody could answer this question. The following is the response I get if I am invoking the web service through POST.
With SOAP response I don't have any problem as I said before.
Following is the way in which I get the reponse for POST/GET
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfAnyType xmlns="GetData.asmx">
<anyType />
<anyType />
</ArrayOfAnyType>
That is, the reposne i am getting is like
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfAnyType xmlns="GetData.asmx">
<anyType xsi:type="Data">
<a>...</a>
<b>...</b>
</anyType>
<anyType xsi:type="Data">
<a>...</a>
<b>...</b>
</anyType>
<anyType xsi:type="Data">
<a>...</a>
<b>...</b>
</anyType>
</ArrayOfAnyType>
How do i make it similar to a SOAP response like
<Data>
<a>...</a>
<b>....</b>
</Data>
....
This is the class I am trying to return
class Data
{
public string a;
public string b;
}
Thanks in advance, Appreciate any response regarding this.