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 (将#修改为@)