使用webclient发送文本文件分隔选项卡

时间:2015-02-10 17:57:22

标签: .net vb.net vbscript

我正在尝试使用webclient发送带有制表符分隔的文件。  但是在尝试上传文件时出错:

  

(远程服务器返回错误:(400)错误请求)

我怎样才能上传文件?

这是网址请求

示例请求:

POST /v1/orders/confirm/ HTTP/1.1
Host: file-api.fillz.com
X-FillZ-Access-Key: EXAMPLEACCESSKEY
X-FillZ-Date: 20141118T222611Z
X-FillZ-Signature: ced6826de95e2bfadd8f937f0ac708e8669e98d4c0145114c84f54174ace327b
Content-Type: application/tab-delimited

_content: 'order-id     status
           1000 shipped'
messageBody = "C:\Temp\Fillz\2015-02-09-09-51-34_proc_file_fillz.tab"
request.ContentType = "application/tab-delimited"
Dim contentType As String = "application/tab-delimited"
Dim myWebClient As New System.Net.WebClient()
myWebClient.Headers.Add("X-FillZ-Date", timeStamp)
myWebClient.Headers.Add("X-FillZ-Access-Key", accessKey)
myWebClient.Headers.Add("X-FillZ-Signature", signature)
Try
   Dim client As New WebClient()
   Dim responseBinary() As Byte = client.UploadFile(uri, messageBody)
   Dim response As String = Encoding.UTF8.GetString(responseBinary)
   Catch ex As Exception
      Return "Exception " & ex.ToString()
End Try

0 个答案:

没有答案