Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 获取在IP上发布的Soap消息_C#_Asp.net_Wcf_Web Services_Soap - Fatal编程技术网

C# 获取在IP上发布的Soap消息

C# 获取在IP上发布的Soap消息,c#,asp.net,wcf,web-services,soap,C#,Asp.net,Wcf,Web Services,Soap,如何在IP上发布soap消息,例如12.23.421.12:3759 是否有任何方法可以读取此IP上的soap消息并从XML解析数据 这是WIRESHARK工具的日志,我需要解析它 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlso ap.org/soap/encoding/" xmlns:

如何在IP上发布soap消息,例如12.23.421.12:3759

是否有任何方法可以读取此IP上的soap消息并从XML解析数据

这是WIRESHARK工具的日志,我需要解析它

<SOAP-ENV:Envelope 
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
   xmlns:SOAP-ENC="http://schemas.xmlso ap.org/soap/encoding/" 
   xmlns:xsi ="http://www.w3.org/2001/XMLSche ma-instance" 
   xmlns:xsd="http://w ww.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
    <huawei:setSubscriberDetails xmlns:huawei="http://business.add.gsm.rcom.com">
        <paramSubscriberDetails>
            <IMEI>355030005026 8312</IMEI>
            <IMSI >405828210239016</IMSI>
            <prepaid>true</prepaid>
            <MSISDN>919646845889</MSISDN>
        </paramSubscriberDetails>
    </huawei:setSubscriberDetails>
</SOAP-ENV:Body>

355030005026 8312
405828210239016
真的
919646845889

尝试向项目中添加服务引用。这将创建一个类和一些方法,您可以使用它们调用soap服务

如果只收到Soap消息,请使用load方法将其加载。 因为它是XML,所以您可以通过

var xDoc = XDocument.Load("http://yourserver.com/yourservice/1");
var body = xDoc.Element("SOAP-ENV:Body");
var huaweiSubscriberDetails = new HuaweiSubscriberDetails(){
     Imei = body.Element("IMEI").Value,
     Imsi = body.Element("IMSI").Value,
     etc...
}

我在没有Visual Studio的情况下就这么做了,所以如果它包含错误,请不要把我牵制在它上面。

我认为您需要在IP:端口上安装TCP侦听器


通常SOAP响应返回到调用方地址(SOAP请求)。如果SOAP请求来自您,则不需要TcpListener。我猜:)

你对get是什么意思?internet上是否有提供信息的服务,或者您自己是否正在实现一个(SOAP)服务,该服务应在特定端口/Ip地址上列出?是的,有一个服务将SOAP消息发送到Ip,我需要解析该消息,我该如何做。您能举一个例子说明您从该服务中得到了什么?特别是在Soap信封中请参阅我从wire shark添加的日志代码。我无法添加服务引用,因为它不是IP上实际承载的服务,问题是Soap消息发送到此IP(源IP不固定,但目标固定)你可以说它就像TCP数据包,每次都在这个IP上运行,我需要抓取这些数据包