我在asp.net核心中构建了一项服务,可通过下面的wsdl访问该服务。我想向此wsdl添加authheader。我该如何实现?我能够成功使用Postman来测试此服务。我使用下面的代码使它看起来像是肥皂服务。
app.UseSoapEndpoint<SampleService>("/webservice/SS.asmx", new BasicHttpBinding(), SoapSerializer.XmlSerializer);
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/" name="SampleService">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
<xs:import namespace="http://schemas.datacontract.org/2004/07/System"/>
<xs:element name="Test">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="TestResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="TestResult" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="SampleService_Test_InputMessage">
<wsdl:part name="parameters" element="tns:Test"/>
</wsdl:message>
<wsdl:message name="SampleService_Test_OutputMessage">
<wsdl:part name="parameters" element="tns:TestResponse"/>
</wsdl:message>
<wsdl:portType name="SampleService">
<wsdl:operation name="Test">
<wsdl:input message="tns:SampleService_Test_InputMessage"/>
<wsdl:output message="tns:SampleService_Test_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_SampleService" type="tns:SampleService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Test">
<soap:operation soapAction="http://tempuri.org/SampleService/Test" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SampleService">
<wsdl:port name="BasicHttpBinding_SampleService" binding="tns:BasicHttpBinding_SampleService">
<soap:address location="http://localhost:32156/webservice/SS.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>