简体   繁体   English

用C#解析SOAP响应

[英]Parse SOAP Response in C#

How can I parse the following soap response string to c# objects and get the values of "applicationUrl" and "applicationValue"? 如何将以下肥皂响应字符串解析为c#对象并获取“ applicationUrl”和“ applicationValue”的值?

<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Header>
</env:Header>
<env:Body>
    <ns2:getAdvertisementsResponse xmlns:ns2="http://ws.mrted.com/">
        <ns2:advertisementResult>
            <advertisements>
                <advertisement>
                    <applicationUrl>
                        http://test.com
                    </applicationUrl>
                    <applicationValue>
                        test
                    </applicationValue>
                </advertisement>
            </advertisements>
            <totalResults>2</totalResults>
        </ns2:advertisementResult>
    </ns2:getAdvertisementsResponse>
</env:Body>

If the service provider is giving you a WSDL, the first thing I would try is the Web Services Description Language Tool (Wsdl.exe): 如果服务提供商正在为您提供WSDL,那么我要尝试的第一件事就是Web服务描述语言工具(Wsdl.exe):

https://msdn.microsoft.com/en-us/library/7h3ystb6(v=vs.80).aspx https://msdn.microsoft.com/zh-CN/library/7h3ystb6(v=vs.80).aspx

The Web Services Description Language tool generates code for XML Web services and XML Web service clients from WSDL contract files, XSD schemas, and .discomap discovery documents. Web服务描述语言工具从WSDL合同文件,XSD架构和.discomap发现文档为XML Web服务和XML Web服务客户端生成代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM