我正在尝试将从Amazon返回的流传输到对象中。 请参阅下文。
Private Function GetReportData(ByVal service As MarketplaceWebServiceClient, ByVal merchantId As String, ByVal reportId As String) As String
Dim request As New GetReportRequest()
request.Merchant = merchantId
request.ReportId = reportId
request.Report = File.Open("report.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite)
Dim data As String = Nothing
Dim response As GetReportResponse = service.GetReport(request)
Using reader = New StreamReader(request.Report, Encoding.UTF8)
' Do something with the value
data = reader.ReadToEnd()
End Using
Return data
End Function
这是返回的一些示例数据。没有xml数据。 它看起来像这样......
“sku fnsku asin product-name reserved_qty reserved_customerorders reserved_fc-transfers reserved_fc-processing
VPD-002 B22EMBMPAC B22EMBMPAC产品名称3 0 3 0
VPD-002 B22EMBMPAC B22EMBMPAC产品名称3 0 3 0
VPD-002 B22EMBMPAC B22EMBMPAC产品名称3 0 3 0
VPD-002 B22EMBMPAC B22EMBMPAC产品名称3 0 3 0“
是否可以将流反序列化为对象?
Public Class ReservedInventory
Public Property sku As String
Public Property fnsku As String
Public Property asin As String
Public Property product_name As String
Public Property reserved_qty As Integer
Public Property reserved_customerorders As Integer
Public Property reserved_fc_transfers As Integer
Public Property reserved_fc_processing As Integer
End Class