使用Vb.net代码从MTOM SOAP响应消息检索XML数据时出现问题。
我们正在从第三方服务获得响应,并希望从中读取XML。
内容长度:980内容类型:多部分/相关; start-info =“ application / soap + xml”; type =“ application / xop + xml”; start =“ http://tempuri.org/0”; boundary =“ uuid:67e1faa6-b9b4-46bf-9ad6-2a570b7b5fc2 + id = 2”; 服务器:Microsoft-IIS / 7.5 MIME版本:1.0 X-Powered-由:ASP.NET 日期:格林尼治标准时间2018年12月5日星期三04:14:46
-uuid:67e1faa6-b9b4-46bf-9ad6-2a570b7b5fc2 + id = 2 Content-ID:http://tempuri.org/0 Content-Transfer-Encoding:8bit Content-Type: application / xop + xml; charset = utf-8; type =“ application / soap + xml”
urn:uuid:b0435c66-182a-4d45-8ca0-ebb315d65c4e错误 参数为false --uuid:67e1faa6-b9b4-46bf-9ad6-2a570b7b5fc2 + id = 2-
我们的应用程序中包含以下代码,它没有给出任何错误,但也没有获取XML数据。
Try
Dim bData As Byte()
Dim br As BinaryReader = New BinaryReader(System.IO.File.OpenRead(TextBox1.Text), System.Text.Encoding.UTF8)
bData = br.ReadBytes(br.BaseStream.Length)
Dim ms As MemoryStream = New MemoryStream(bData, 0, bData.Length)
ms.Write(bData, 0, bData.Length)
ms.Position = 0
MsgBox(ms.Length.ToString)
Dim reader As XmlDictionaryReader = XmlDictionaryReader.CreateMtomReader(ms, System.Text.Encoding.UTF8, XmlDictionaryReaderQuotas.Max)
If reader.HasValue Then
Dim strXML = reader.ReadInnerXml()
MsgBox(strXML)
End If
Catch ex As Exception
End Try
我们如何从MTOM响应中检索数据?
谢谢, 菜