添付ファイルのデータをバイト配列に入れて送信するだけではどうですか?これらの線に沿って何かを持つバイト配列(この関数に渡し、取り付けのためのストリームをオープン)にあなたのファイルをストリーミング
Public Class SoapPackage
Public Property AttachmentName() As String
Get
Return m_AttachmentName
End Get
Set
m_AttachmentName = Value
End Set
End Property
Private m_AttachmentName As String
' put your file data in here
Public Property AttachmentData() As Byte()
Get
Return m_AttachmentData
End Get
Set
m_AttachmentData = Value
End Set
End Property
Private m_AttachmentData As Byte()
End Class
:
Public Shared Function StreamToByteArray(input As Stream) As Byte()
Dim buffer As Byte() = New Byte(16 * 1024 - 1) {}
Using ms As New MemoryStream()
Dim read As Integer
While (InlineAssignHelper(read, input.Read(buffer, 0, buffer.Length))) > 0
ms.Write(buffer, 0, read)
End While
Return ms.ToArray()
End Using
End Function
編集:
はちょうどそれを学びました私のStreamToByteArray
機能は簡単に置き換えることができます:
Dim filePath as String = "Path\to\file"
Dim fileBytes as Byte() = System.IO.File.ReadAllBytes(filePath)
私の問題は添付ファイルです。プロジェクトでもそれを使って作業していますか? – seth
添付ファイルを使って正確に何を意味しますか?これの例を挙げることはできますか? – Kevinc
私はxmlファイルを持っているので、soap要求と一緒に送る必要があります。私が読んだところからは、.NETではこれがサポートされていないように見えますが、これが何を意味するのか分かりません。 – seth