Я пытаюсь написать небольшой SOAP-сервер, который подключается к QuickBooks Web Connector, но у меня есть некоторые проблемы с поиском правильных контрактов. Я всегда получаю следующую ошибку:Подходящий контракт между WCF Service и QuickBooks Web Connector
Web Connector
Method x cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
Я создал пустое веб-приложение ASP .NET и добавил службу WCF. Здесь вы найдете фрагмент из authenticate
метода: Интерфейс
службы WCF реализации
[ServiceContract]
public interface IQuickBooks
{
[OperationContract]
AuthenticateResponse authenticate(Authenticate authenticateSoapIn);
}
службы WCF
public class QuickBooks : IQuickBooks
{
public AuthenticateResponse authenticate(Authenticate authenticateSoapIn)
{
return new AuthenticateResponse
{
AuthenticateResult = new[] { "1", "none" }
};
}
}
Запрос
[DataContract(Name = "authenticate")]
public class Authenticate
{
[DataMember(Name = "strUserName", IsRequired = true)]
public string Username { get; set; }
[DataMember(Name = "strPassword", IsRequired = true)]
public string Password { get; set; }
}
Response
[DataContract(Name = "authenticateResponse")]
public class AuthenticateResponse
{
[DataMember(Name = "authenticateResult", IsRequired = true)]
public string[] AuthenticateResult { get; set; }
}
Here вы можете найти WSDL из QuickBooks и my WSDL-выход. Обратите внимание, что я применил только метод authenticate
для тестирования. Я предполагаю, что ошибка wsdl:types
вызывает ошибку. В исходном WSDL из QuickBooks authenticate
type
имеет два примитивных типа для username
и password
.
Как я могу реализовать службу WCF с веб-коннектором QuickBooks? Что я не так?
Дополнительная информация
StackTrace
The message with Action 'http://developer.intuit.com/authenticate' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
More info:
StackTrace = at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at QBWebConnector.localhost.WCWebServiceDoc.authenticate(String strUserName, String strPassword)
at QBWebConnector.localhost.WCWebService.authenticate(String strUserName, String strPassword)
at QBWebConnector.SOAPWebService.authenticate(String UserName, String Password)
at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)