0
SOAP 요청을 받고 SOAP 응답을 반환하는 웹 서비스를 개발하고 싶습니다. 나는 이것을 어떻게하는지 모른다. 지금까지 다음 코드를 사용하여 메시지를 교환하고 있습니다. 사람이 내 서비스를 제대로WCF를 사용하여 SOAP 메시지 교환
IService.cs을 설정하는 데 도움이 될 수 있습니다
[OperationContract(Name = "Receive")]
[WebInvoke(Method = "POST", UriTemplate = "Receive")]
string Receive(Stream odata);
Service.cs
public string Receive(Stream data)
{
string [email protected]"<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/""
xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:xsi=""http:/
/www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/
XMLSchema"">
<SOAP-ENV:Body>
<m:Execute xmlns:m=""http://tempuri.org/"">
<m:name>name1</m:name>
<m:Value></m:Value>
</m:Execute>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>";
return response;
}
여기
의 Web.config의 일부 마침내
<system.serviceModel>
<services>
<service name="Service" behaviorConfiguration="myServiceBehavior">
<endpoint name="webHttpBinding" address="" binding="webHttpBinding" contract="IService" behaviorConfiguration="webHttp"/>
<endpoint name="mexHttpBinding" address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>