C# 读取soap协议中的数据

yjl49 2010-10-14 02:20:06
服务器中接收到的soap协议传输的数据如下:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:orderRelationUpdateNotify soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://soap.bossagent.vac.unicom.com">
<orderRelationUpdateNotifyRequest href="#id0"/>
</ns1:orderRelationUpdateNotify>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:OrderRelationUpdateNotifyRequest" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://req.sync.soap.bossagent.vac.unicom.com">
<CreateTime href="#id1"/>
<UserorderTime xsi:type="soapenc:string"></updateTime>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">Y</multiRef>
</soapenv:Body>
</soapenv:Envelope>


现在我需要读取CreateTime标签对应的值,可它的值是按soap协议放在id为 id1 的标签处的。他这次是id1下次就有可能是idN 那么我如何去取这个值?
有没有一个标准的方法,使用后可以直接取到CreateTime对应的值,而不用我再去分析他的href,再根据href去找那个值?


...全文
440 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjl49 2010-10-14
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 ly_longyue 的回复:]
这个通过xml 获得接点, 可以根据path

C# code


/// <summary>
/// 获取新加入插件的ID
/// </summary>
/// <returns>id号</returns>
public int GetID()
{
Xm……
[/Quote]

你的意思是我先去取那个id号,再拿这个id号去找值? 我是担心他过段时间又写成这样:
<CreateTime>Y</CreateTime>
所以想问下有没有方便的方法。
yjl49 2010-10-14
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 ireenter 的回复:]
是字段名吗?生成dataset时可以指定标签的名称。
[/Quote]
dataSet ? 没理解你的意思。
龍月 2010-10-14
  • 打赏
  • 举报
回复
这个通过xml 获得接点, 可以根据path


/// <summary>
/// 获取新加入插件的ID
/// </summary>
/// <returns>id号</returns>
public int GetID()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Application.StartupPath + "\\Plugins\\Plugin.xml");
int id = 1;

for ( id = 1; ; id++)
{
XmlNode node = xmlDoc.SelectSingleNode("ClassInfo/class[@Id='" + id + "']");
if (node == null)
{
return id;
}
}


}

这样来稿
ireenter 2010-10-14
  • 打赏
  • 举报
回复
是字段名吗?生成dataset时可以指定标签的名称。

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧