【发布时间】:2015-08-23 19:58:13
【问题描述】:
我正在尝试编写一个小型 SOAP 服务器,它连接到 QuickBooks Web 连接器,但我很难找到正确的合同。我总是收到以下错误:
网络连接器
由于 ContractFilter,方法 x 无法在接收方处理 EndpointDispatcher 不匹配。这可能是因为 合同不匹配(发送方和接收方之间的操作不匹配)或 发送方和接收方之间的绑定/安全不匹配。 检查发送者和接收者是否具有相同的合同和相同的 绑定(包括安全要求,例如消息、传输、 无)。
我创建了一个空的 ASP .NET Web 应用程序并添加了一个 WCF 服务。您将在这里找到authenticate 方法的 sn-p:
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; }
}
回应
[DataContract(Name = "authenticateResponse")]
public class AuthenticateResponse
{
[DataMember(Name = "authenticateResult", IsRequired = true)]
public string[] AuthenticateResult { get; set; }
}
Here 你可以从 QuickBooks 和my WSDL 输出中找到 WSDL。请注意,我只实现了authenticate 方法进行测试。我猜wsdl:types 不匹配会导致错误。在来自 QuickBooks 的原始 WSDL 中,authenticatetype 有两种基本类型:username 和 password。
如何使用 QuickBooks Web 连接器实现 WCF 服务?我做错了什么?
其他信息
堆栈跟踪
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)
【问题讨论】:
标签: c# web-services wcf quickbooks connector