Delphi Win32客户端中使用WCF服务(basicHttpBinding)的问题
我正在尝试创建一个 Delphi 客户端(Delphi 2006)来与使用 WCF 编写的服务进行通信。 服务非常简单,只有一项功能。 从技术上讲,如下所示:
[ServiceContract (Namespace = "http://www.company.com/sample/")]
public interface IService
{
[OperationContract]
string GetNumber (string name);
}
我已在 IIS 上托管此服务,并使用带有 mex 端点的 basicHttpBinding 公开它。 我可以在 .NET 客户端中使用它。
我尝试运行 WSDLImp.exe,它生成了一个源代码单元(顺便说一句,它生成了奇怪的类来封装字符串类型。为什么它不能与 Delphi 字符串类型相同?)。 当我尝试调用此服务时,出现异常:
由于 EndpointDispatcher 上的 ContractFilter 不匹配,无法在接收方处理带有 Action '' 的消息。 这可能是因为合同不匹配(发送者和接收者之间的操作不匹配)或发送者和接收者之间的绑定/安全不匹配。 检查发送方和接收方是否具有相同的合约和相同的绑定(包括安全要求,例如消息、传输、无)。
我没有看到任何方法来配置 Delphi Win32 客户端来更改绑定或安全参数。 我该如何解决这个问题?
I am trying to make a Delphi client (Delphi 2006) to communicate with a service written using WCF. Service is damn simple with just one function. Technically like below:
[ServiceContract (Namespace = "http://www.company.com/sample/")]
public interface IService
{
[OperationContract]
string GetNumber (string name);
}
I have hosted this service on IIS and exposed it using basicHttpBinding with mex end point. I am able to use it in .NET clients.
I tried to run WSDLImp.exe and it generated a source code unit (btw, it generates wierd classes to encapsulate string type. Why cant it be same as Delphi string type?). When I try to call this service, I get the exception:
The message with Action '' 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).
I don't see any way to configure the Delphi Win32 client to changing the binding or security parameters. How can I fix this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也遇到过完全相同的问题。 Delphi 只是很难导入 WCF 公开的 WSDL。 一种解决方案是将 ASMX 包装器添加到您的服务中并将其与 Delphi 客户端一起使用。
这是一个例子:
I've had the exact same problem. Delphi just has hard time importing the WSDL exposed by WCF. One solution is to add an ASMX wrapper to your service and use that with Delphi clients.
Here's an example:
您需要查看客户端和服务之间的网络流量以了解发生了什么情况。 或者,打开服务上的 WCF 跟踪,可能包括消息跟踪。 您应该能够非常详细地看到正在发生的事情。
You need to look at the network traffic between the client and service to see what's going on. Alternatively, turn on WCF tracing on the service, possibly including message tracing. You should be able to see what's going on, in great detail.