WCF Returning HTML Instead of XML
Can some one tell me why am I getting the following dat开发者_JAVA百科a in return of WCF service request? I want the formatted XML so that I can parse it.
<?xml version="1.0" encoding="utf-8"?><string><DocumentElement>
<UT>
<UserFirstName>z</UserFirstName>
<UserLastName>z</UserLastName>
<LastLoginDate>2010-08-18T14:46:42.623-07:00</LastLoginDate>
<UserID>1245</UserID>
<ImageURL>~/Images/UserPhotos/shaddow.gif</ImageURL>
<USERGUID>151c272d-7b8c-4546-a901-b3672f3d0802</USERGUID>
</UT>
<UT>
<UserFirstName>y</UserFirstName>
<UserLastName>y</UserLastName>
<LastLoginDate>2010-08-18T14:46:20.67-07:00</LastLoginDate>
<UserID>1247</UserID>
<ImageURL>~/Images/UserPhotos/shaddow.gif</ImageURL>
<USERGUID>8bb17541-1cd8-4e9d-9045-2ef80fa691e3</USERGUID>
</UT>
</DocumentElement></string>
Your service returns string. XML passed in a string is always encoded. If you want to get unencoded XML you have to return objects which will be serialized to XML (DataContracts) or you can try to return XmlElement / XElement.
精彩评论