【发布时间】:2014-05-19 22:44:41
【问题描述】:
我有一个来自 Web 服务的肥皂消息作为 Xdocument,并希望提取会话 id 元素以供将来使用。我可以使用下面的代码循环响应,但是我将如何查询肥皂以返回 sessionid
Dim dnas = From node In Responce.DescendantNodes _
Select node
For Each node In dnas
If TypeOf node Is XElement Then
Debug.Print(DirectCast(node, XElement).Name.ToString)
Else
Debug.Print(node.ToString)
End If
Next
肥皂:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CreateResponse xmlns="http://myweb.com/webservices">
<CreateResult>
<ResultCode>0</ResultCode>
<ResultDescription>Authentication Successful</ResultDescription>
<sessionid>04e1b723-ff93-4af0-94f4-2245ccf11f42</sessionid>
</CreateResult>
</CreateResponse>
</soap:Body>
</soap:Envelope>
【问题讨论】:
标签: soap xml-parsing linq-to-xml