微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SOAP Core 不需要的命名空间

如何解决SOAP Core 不需要的命名空间

我正在集成 SOAP 服务,我希望有类似的请求格式,我目前面临的问题是我的请求如下

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:tst="http://schemas.datacontract.org/2004/07/tstSoapCore.wsdl.supply" xmlns:sys="http://schemas.datacontract.org/2004/07/System">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:SupplyService>
         <tem:supplyServiceRequest>
            <!--Optional:-->
            <tst:BN>?</tst:BN>
            <!--Optional:-->
            <tst:GTIN>?</tst:GTIN>
            <!--Optional:-->
            <tst:MD>?</tst:MD>
            <!--Optional:-->
            <tst:SNREQUESTLIST>
               <!--Zero or more repetitions:-->
               <sys:SN>?</sys:SN>
            </tst:SNREQUESTLIST>
            <!--Optional:-->
            <tst:XD>?</tst:XD>
         </tem:supplyServiceRequest>
      </tem:SupplyService>
   </soapenv:Body>
</soapenv:Envelope>

我很困惑为什么 tem: 和 tst: 和 sys: 存在,这是我的代码

namespace tstSoapCore.wsdl.supply
{
    [XmlRoot("SupplyServiceRequest)"]
    [DataContract]
    //[MessageContract(IsWrapped = true)]//,WrapperName = "SupplyServiceRequest",WrapperNamespace ="sup")]
    public class SupplyServiceRequest
    {
        [DataMember]
        public string GTIN { get; set; }
        ...
}

最后我的创业

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSoapCore();
            services.TryAddSingleton<SupplyServiceMain>();
            
        }
            app.UseEndpoints(endpoints =>
            {
            endpoints.UseSoapEndpoint<ISupplyService>("/SupplyService.svc",new BasicHttpBinding(),SoapSerializer.DataContractSerializer);
                endpoints.MapGet("/",async context =>
                {
                    context.Response.Redirect("SupplyService.svc");
                });
            });
        }
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。