是有一个简单的方式来查询一个网络服务以看到的消息,它支持?C#.网应用程序,我的工作需要能够处理一个老版本的网站服务,不实现消息我想发送。该网服务不让一个版本的数量,因此B计划就是看如果消息定义。

我假设我可以仅仅是使一个HTTP请求为户进行分析,但在此之前,我走这条道路,我想确保没有一个简单的方法。

更新:我已经决定让户获得信息。这里的粗略的草案得到所有消息:

HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create( "http://your/web/service/here.asmx?WSDL" );
webRequest.PreAuthenticate = // details elided
webRequest.Credentials = // details elided
webRequest.Timeout = // details elided
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();

XPathDocument xpathDocument = new XPathDocument( webResponse.GetResponseStream() );
XPathNavigator xpathNavigator = xpathDocument.CreateNavigator();

XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager( new NameTable() );
xmlNamespaceManager.AddNamespace( "wsdl", "http://schemas.xmlsoap.org/wsdl/" );

foreach( XPathNavigator node in xpathNavigator.Select( "//wsdl:message/@name", xmlNamespaceManager ) )
{
    string messageName = node.Value;
}
有帮助吗?

解决方案

我敢肯定WSDL的方式做到这一点。

其他提示

分析WSDL可能是最简单的方式做到这一点。使用WCF,它也可以下载WSDL在运行时,基本上运行svcutil在它通过代码,并结束了一个动态产生的代理,你可以检查结构。看看 http://blogs.msdn.com/vipulmodi/archive/2006/11/16/dynamic-programming-with-wcf.aspx 为实例的运行产生的代理。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top