.netxmlsoapasp.net-core-3.1soapcore

SoapCore Read Soap1.1


I have followed mulitple examples online but cannot seem to get the below to work. For all examples the following request will work:

<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>

However when I change this to have the soap tags it does not work.

<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>

Is there a particular setting I am missing?

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);

Solution

  • In your second example:

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

    should be:

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

    See also: What are XML namespaces for?