Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cause .net WCF client to use RPC/encoded instead of Document/Literal/Wrapped with Delphi service

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

like image 340
Irwin Avatar asked Oct 12 '22 13:10

Irwin


1 Answers

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).

like image 115
Rest Wing Avatar answered Oct 15 '22 10:10

Rest Wing