2016-12-23 9 views
0

SOAP要求を受信して​​SOAP応答を返すWebサービスを開発したいと考えています。私はこれをする方法を知らない。私はこれまでメッセージを交換するために以下のコードを使用しています。誰も私が正しく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> 

答えて

0

の一部です。問題を修正しました。特別な設定でWSEをサポートするサービスを提供する必要がありました

関連する問題