question

hermanncsl avatar image
0 Likes"
hermanncsl asked

downloadFile error 500 (c#)

When i call the downloadFile request i get an error 500 internal server error. here is my code: string endPoint = _UseSandBox ? " https://storage.sandbox.ebay.com/FileTransferService" : " https://storage.ebay.com/FileTransferService"; string xml = " " + FileReferenceID + " " + TaskReferenceID + " "; HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(endPoint); StringBuilder sbResp = new StringBuilder(); System.Text.Encoding iso8859 = System.Text.Encoding.GetEncoding("ISO-8859-1"); httpRequest.ContentType = "text/xml"; httpRequest.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "downloadFile"); httpRequest.Headers.Add("X-EBAY-SOA-SECURITY-TOKEN", _context.ApiCredential.eBayToken); httpRequest.Headers.Add("X-EBAY-SOA-SERVICE-NAME", "FileTransferService"); // Optional httpRequest.Headers.Add("X-EBAY-SOA-SERVICE-VERSION","1.0.0"); // Optional httpRequest.Method = "POST"; UTF8Encoding encoding = new UTF8Encoding(); int dataLen = encoding.GetByteCount(xml); byte[] utf8Bytes = new byte[dataLen]; Encoding.UTF8.GetBytes(xml, 0, xml.Length, utf8Bytes, 0); Stream stream = httpRequest.GetRequestStream(); stream.Write(utf8Bytes, 0, utf8Bytes.Length); stream.Close(); WebResponse webResponse = httpRequest.GetResponse(); stream = webResponse.GetResponseStream(); at the point **WebResponse webResponse = httpRequest.GetResponse();** i get the error 500. What is wrong with the code?
c#error 500downloadfile
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.