SoapCore 读取 Soap1.1

SoapCore Read Soap1.1

我在网上关注了多个示例,但似乎无法使以下内容正常工作。对于所有示例,以下请求都有效:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Body>
        <Process xmlns="http://sample.namespace.com/service/2.19/">
            <!-- Optional -->
            <ActionARequest>
                <Id>"Test"</Id>
                <Name>"Test"</Name>
            </ActionARequest>
        </Process>
    </Body>
</Envelope>

然而,当我将其更改为具有 soap 标签时,它不起作用。

<soap:Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <Process xmlns="http://sample.namespace.com/service/2.19/">
            <!-- Optional -->
            <ActionARequest>
                <Id>"Test"</Id>
                <Name>"Test"</Name>
            </ActionARequest>
        </Process>
    </soap:Body>
</soap:Envelope>

我是否缺少特定的设置?

Startup.cs:

var transportBinding = new HttpTransportBindingElement();
            var textEncodingBinding = new TextMessageEncodingBindingElement(MessageVersion.Soap11, System.Text.Encoding.UTF8);
            var customBinding = new CustomBinding(transportBinding, textEncodingBinding);
            app.UseSoapEndpoint<ICallbackService>("/integration-service/v2_17/ActionA", customBinding, SoapSerializer.XmlSerializer);

在你的第二个例子中:

<soap:Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">

应该是:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

另请参阅:What are XML namespaces for?