问题描述
我在网上遵循了多个示例,但似乎无法使以下内容起作用。对于所有示例,以下请求都有效:
<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: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/">