【问题标题】:Accepting SOAP input as parameter in webservice接受 SOAP 输入作为 Web 服务中的参数
【发布时间】:2010-11-11 09:25:02
【问题描述】:

我有一个需要接受 SOAP 作为输入参数的 web 服务方法。我曾在 .NET 客户端之间使用过 Web 服务,但我从未使用过原始 SOAP,所以我不知道该怎么做。输入格式如下:

<?xml version="1.0" encoding="utf-8"?>
<S:Envelope xmlns:S = "http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:RemoteService xmlns:ns2 = "some.ns.url">
            <RemoteServiceInput>
                <param1>123</param1>
                <param2>Asd Qwe</param2>
                <param3 xsi:nil = "true" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"/>
            </RemoteServiceInput>
        </ns2:RemoteService >
    </S:Body>
</S:Envelope>

我的方法输入应该如何接受这个 SOAP 作为参数?

我使用的是 ASP.NET Web 服务而不是 WCF。

【问题讨论】:

    标签: .net asp.net web-services soap


    【解决方案1】:

    您可以创建一个接受 XElement 作为参数的 WebMethod(一天结束时的 SOAP 是 XML):

    [WebMethod]
    public mySoapMethod(XElement soapMessage)
    {
        //here you can parse your soap message
    }
    

    【讨论】:

      猜你喜欢
      • 2016-02-28
      • 1970-01-01
      • 2023-03-05
      • 2016-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-25
      • 1970-01-01
      相关资源
      最近更新 更多