HTTP/1.1 500 Internal Server Error при попытке взаимодействия JQuery.soap-запроса с WCF-службой

Рейтинг: 1Ответов: 2Опубликовано: 22.04.2015

Здравствуйте! Пытаюсь отправить данные через JQuery.soap службе WCF, хостом для которой является Windows-служба. Получаю "HTTP/1.1 500 Internal Server Error" и "Сообщение с Action "" не может быть обработано на стороне получателя из-за несоответствия ContractFilter на EndpointDispatcher. Возможно, это связано с несоответствием контрактов (несогласованность действий на стороне отправителя и получателя) или несоответствием привязка/защита на стороне отправителя и получателя. Убедитесь, что отправитель и получатель имеют один и тот же контракт и одинаковые привязки (включая требования к защите, например, Message, Transport или None)." Скрипт и код WCF приведены ниже. Просьба помочь.

    [DataContract]
    public class Cars_Data
    {
        [DataMember]
        public int id;
    }

    [ServiceContract(Namespace = "http://C_M_Service")]
    public interface ICMInterface
    {
        [OperationContract(Action = "http://localhost:8123/C_M_Service/GetCars")]        
        [WebGet(RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)]
        [WebInvoke(Method="POST", BodyStyle=WebMessageBodyStyle.Wrapped)]

        string GetCars(int Cars_Data);
    }

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]    

    public class Car_market : ICMInterface
    {      
        public  string  GetCars(int Cars_Data)
        {            
            return("<result>\"OK\"</result>");            
        }
    }


    $.soap({
            url: "http://localhost:8123/C_M_Service/",
            method: "GetCars",            
            soap11:true,
            data: "<id>123</id>",
            error: function (soapresponse) {
                alert("Oh no is error: "+soapresponse.toString());
            },
            success: function (result) {
                alert("OK "+result.toString());
            }
        });

<system.serviceModel>   
    <services>
    <service name="C_M_Service.Car_market">      
      <endpoint address="http://localhost:8123/C_M_Service" binding="webHttpBinding" 
        bindingConfiguration="" contract="C_M_ServiceReference1.ICMInterface"
        name="WSHttpBinding_ICMInterface1">        
        <identity>
          <servicePrincipalName value="host/PC" />        
        </identity>
      </endpoint>
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost:8123/C_M_Service"/>
        </baseAddresses>
      </host>
      </service>
    </services> 
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" httpHelpPageEnabled="False"/>
        </behavior>
      </serviceBehaviors>  
    </behaviors>    
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true">   
</serviceHostingEnvironment>
  </system.serviceModel>

Добавил указание версии SOAP:
    <bindings>
          <customBinding>
             <binding name="Soap11">
                <textMessageEncoding messageVersion="Soap11" />
                <httpTransport />
             </binding>
          </customBinding>
    </bindings>

Ответы

Ответов пока нет.