christophewilso_34 avatar image
christophewilso_34 asked

Why am I receiving 500: Internal Server Error?

Full (minimum code) subroutine attached: I have been working on this for over a week, I can't figure out what I am doing wrong. At the risk of being pilloried publicly, will someone please help? If this is the wrong forum (didn't see an LMS or an inventory update forum), please let me know. Sub eBayUploadFile() Dim myCurrentJobID As String = "50014945668" Dim myCurrentFileReferenceID As String = "50015245168" Dim YourSecurityToken As String = "..." Dim myUUID As String = System.Guid.NewGuid.ToString() Dim myReqUUID As String = System.Guid.NewGuid.ToString() Dim myAttchmtUUID As String = System.Guid.NewGuid.ToString() Dim myFilePath As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\" Dim fs As System.IO.FileStream = System.IO.File.OpenRead(myFilePath) Dim myFsLength As Long = fs.Length Dim thedata As Byte() thedata = New Byte(myFsLength) {} fs.Read(thedata, 0, myFsLength) Dim myXMLRequestString As String myXMLRequestString = "--MIMEBoundaryurn_uuid_" & myUUID & vbCrLf & "Content-Type: application/xop+xml; charset=utf-8; type=""text/xml""" & vbCrLf & "Content-Transfer-Encoding: binary" & vbCrLf & "Content-ID: <0.urn:uuid:" & myReqUUID & ">" & vbCrLf & vbCrLf & ""), System.Net.HttpWebRequest) request.Method = "POST" request.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "uploadFile") request.Headers.Add("X-EBAY-SOA-SECURITY-TOKEN", YourSecurityToken) request.Accept = "application/xml" Dim mycontenttype As String = "multipart/related; boundary=MIMEBoundaryurn_uuid_" & myUUID & ";type=""application/xop+xml"";start=""<0.urnuuid:" & myReqUUID & ">"";start-info=""text/xml""" request.ContentType = mycontenttype request.ContentLength = arr.Length + thedata.Length + arr2.Length Dim dataStream As System.IO.Stream = request.GetRequestStream() dataStream.Write(arr, 0, arr.Length) dataStream.Write(thedata, 0, thedata.Length) dataStream.Write(arr2, 0, arr2.Length) dataStream.Close() Dim response As System.Net.HttpWebResponse = DirectCast(request.GetResponse(), System.Net.HttpWebResponse) Dim readStream As New System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8")) Dim myXMLResponse As String = readStream.ReadToEnd Console.WriteLine(myXMLResponse) Console.WriteLine("press a key to end") Console.Read() End Sub If anyone thinks it would help, I would gladly attach the sandbox token I have been using for the other calls. In case it matters, the two 11 digit IDs in the code are confirmed active and waiting right now through my (working) getJobs call, and I can (and do) use the downloadFile call of the File Transfer API with these very settings and headers. This is the only call I need that sends more than just XML, and this is the only call that sends a file. I assume that the problem lies there, but I haven't found any understanding through the documentation. If the answer is to RTM, please point me to the specific manual pages. I have tried many, but haven't found the correct one yet. When the exception occurs at `request.GetResponse()`, `arr.length` is 907, `arr2.length` is 63, and `thedata.length` is 449.
10 |600

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

1 Answer

· avatar image
0 Likes" answered
Hi, I checked the JobID in the post: 50014945668, but I cannot access the request or response files. Can you please send us the requests file that you are sending? I feel that the file maybe invalid. Cheers!!!
10 |600

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

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.