Исключение при загрузке класса веб-сервиса xml."There is no Unicode byte order mark. Cannot switch to Unicode.",
public static ReturnType Create<ReturnType>()
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(
string.Format("{0}/Create?EntityName='{1}'",
sUri.TrimEnd('/'),
typeof(ReturnType).Name)
);
NetworkCredential serviceCreds = new NetworkCredential(UserName, Password);
CredentialCache cache = new CredentialCache();
cache.Add(new Uri(sUri), "Basic", serviceCreds);
req.Credentials = cache;
req.Method = "GET";
req.ContentType = "application/xml";
req.Timeout = 1000 * 60 * 15; // 15 minutes
try
{
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
XDocument doc = XDocument.Load(resp.GetResponseStream()); //Error here
resp.Close();
ReturnType oEntity = doc.Root.Value.ToBusinessEntity<ReturnType>(SourceFormatEnum.XML);
return oEntity;
}
Как это исправить?