导致 .net WCF 客户端使用 RPC/encoded 而不是 Document/Literal/Wrapped with Delphi 服务

发布于 2024-10-22 02:22:17 字数 525 浏览 1 评论 0原文

我有一个基于 Delphi 服务构建的 .Net WCF 客户端/代理。 Delphi 服务以我的客户端无法处理的格式提供 SOAP 消息。

根据此处的指导:Delphi SOAP Envelope 和 WCF 我开始了解这一点WCF 希望“文档/文字/包装”样式成为消息序列化的方式。事实证明,Delphi 服务使用“rpc”作为样式。

我无法让 delphi 服务更改其样式。

有没有办法让 WCF 客户端改用“rpc”。

作为参考,这是我正在构建的 Delphi 服务: http://www.tntschools.com /AkiTimeTableService/wsdl/ICourses

I have a .Net WCF client/proxy built based on a Delphi service. The Delphi service is providing SOAP messages in a format that my client has been unable to process.

Based on the guidance here: Delphi SOAP Envelope and WCF I've come to understand that WCF expects "Document/Literal/Wrapped" style to be the way in which the message is serialized. As it turns out, the Delphi service is using "rpc" as the style.

I cannot get the delphi service to change its style.

Is there a way I can tell the WCF client to use "rpc" instead.

For reference, here's the Delphi service I'm building against: http://www.tntschools.com/AkiTimeTableService/wsdl/ICourses

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

°如果伤别离去 2024-10-29 02:22:17

当以这种方式添加服务引用时,每个生成的消息契约都会以类似于以下方式的方式进行装饰:

[DebuggerStepThrough]
[GeneratedCode( "System.ServiceModel", "4.0.0.0" )]
[MessageContract( WrapperName = "GetCourseList", WrapperNamespace = "urn:CoursesIntf-ICourses",
    IsWrapped = true )]
public partial class GetCourseListRequest
{
    [MessageBodyMember( Namespace = "", Order = 0 )]
    public string licence;

    public GetCourseListRequest()
    {
    }

    public GetCourseListRequest( string licence )
    {
        this.licence = licence;
    }
}

每个生成的操作契约都以类似于以下方式的方式进行装饰:

[GeneratedCode( "System.ServiceModel", "4.0.0.0" )]
[ServiceContract( ConfigurationName = "ServiceReferences.ICourses" )]
public interface ICourses
{
    [OperationContract( Action = "urn:CoursesIntf-ICourses#GetCourseList", ReplyAction = "*" )]
    [XmlSerializerFormat( Style = OperationFormatStyle.Rpc, SupportFaults = true,
        Use = OperationFormatUse.Encoded )]
    [ServiceKnownType( typeof( TCourse ) )]
    GetCourseListResponse GetCourseList( GetCourseListRequest request );

    // Remaining operation contracts omitted
}

检查 Reference.cs 以确定您的消息和操作合约的装饰方式相同。如果是的话,问题就出在其他地方。异常消息将有助于追踪问题(例如,它可能是返回的 SOAP 消息中元素的顺序)。

When adding the service reference this way, each generated message contract is decorated in similar way as following one:

[DebuggerStepThrough]
[GeneratedCode( "System.ServiceModel", "4.0.0.0" )]
[MessageContract( WrapperName = "GetCourseList", WrapperNamespace = "urn:CoursesIntf-ICourses",
    IsWrapped = true )]
public partial class GetCourseListRequest
{
    [MessageBodyMember( Namespace = "", Order = 0 )]
    public string licence;

    public GetCourseListRequest()
    {
    }

    public GetCourseListRequest( string licence )
    {
        this.licence = licence;
    }
}

Each generated operation contract is decorated in similar way as following one:

[GeneratedCode( "System.ServiceModel", "4.0.0.0" )]
[ServiceContract( ConfigurationName = "ServiceReferences.ICourses" )]
public interface ICourses
{
    [OperationContract( Action = "urn:CoursesIntf-ICourses#GetCourseList", ReplyAction = "*" )]
    [XmlSerializerFormat( Style = OperationFormatStyle.Rpc, SupportFaults = true,
        Use = OperationFormatUse.Encoded )]
    [ServiceKnownType( typeof( TCourse ) )]
    GetCourseListResponse GetCourseList( GetCourseListRequest request );

    // Remaining operation contracts omitted
}

Check the Reference.cs to determine whether your message and operation contracts are decorated same way. If they are, the issue lies elsewhere. Exception message would be helpful to track down the issue (e.g. it may be the order of elements in returned SOAP message).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文