WCF如何更改soap请求方法名称.NET Core API
我使用 Visual Studio 2022 编辑器从 WSDL 自动创建类。当我使用 Soap UI 调用方法时,我试图确保方法名称不会出现在请求 XML 结构中。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://belediye.turkiye.gov.tr/v3">
<soapenv:Header/>
<soapenv:Body>
<v3:sicilSorgula> ---->> This is method name and I want to remove this element
<!--Optional:-->
<v3:sicilSorgulamaG>
</v3:sicilSorgulamaG>
</v3:sicilSorgula>
</soapenv:Body>
</soapenv:Envelope>
我尝试过
[MessageContract(IsWrapped=false)]
,但没有成功
请求 XML 结构必须是这样的:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://belediye.turkiye.gov.tr/v3">
<soapenv:Header/>
<soapenv:Body>
<!--Optional:-->
<v3:sicilSorgulamaG>
<!--Optional:-->
</v3:sicilSorgulamaG>
</soapenv:Body>
</soapenv:Envelope>
I created classes automatically from a WSDL using the Visual Studio 2022 editor. I am trying to ensure that the method name does not appear in the request XML structure when I call the method using Soap UI.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://belediye.turkiye.gov.tr/v3">
<soapenv:Header/>
<soapenv:Body>
<v3:sicilSorgula> ---->> This is method name and I want to remove this element
<!--Optional:-->
<v3:sicilSorgulamaG>
</v3:sicilSorgulamaG>
</v3:sicilSorgula>
</soapenv:Body>
</soapenv:Envelope>
I tried
[MessageContract(IsWrapped=false)]
but that didn't work
Request XML structure must be like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://belediye.turkiye.gov.tr/v3">
<soapenv:Header/>
<soapenv:Body>
<!--Optional:-->
<v3:sicilSorgulamaG>
<!--Optional:-->
</v3:sicilSorgulamaG>
</soapenv:Body>
</soapenv:Envelope>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
System.Web.Services
是WCF的前身。由于即使是强大的WCF也被认为在服务器端被弃用,因此不要期望system.web.services
在.NET Core或Concrete App Model Model Asp.net Core 1.0中可用。他们的名称空间甚至从Microsoft.aspnetcore开始。肥皂被认为是弃用休息和JSON的弃用。微软会告诉您:使用 .NET框架,但不是 .net core 。System.Web.Services
is a predecessor of WCF. Since even the mighty WCF is considered deprecated on the server side, do not expectSystem.Web.Services
to be available in .NET Core or the concrete App Model ASP.NET Core 1.0. Their namespaces even start with Microsoft.AspNetCore. SOAP is considered deprecated in favor of REST and JSON. Microsoft will tell you: Use the .NET Framework but not .NET Core.