'WCF + Xml-Rpc don't work

I have a classic WCF webservice. Few weeks ago, in order to answer to a client demand, I added Rest management to my webservice.

But, at the beginning of the week, another client said to me its system can only manage XML-RPC. So he needs to connect to my webservice via this protocol.

So I found this : Configuring XML-RPC behavior for IIS-hosted .SVC file?

First, I compiled the Microsoft.Samples.XmlRpc in order to add it to my project. Two Dll appears : Microsoft.Samples.XmlRpc & Microsoft.ServiceModel.XmlRpc

Then, I created a XmlRpcEndpointBehaviorExtension class, the same as the post above :

namespace WsZendesk
{
    public class XmlRpcEndpointBehaviorExtension : BehaviorExtensionElement
    {
        protected override object CreateBehavior()
        {
            // this comes from Microsoft.Samples.XmlRpc
            return new XmlRpcEndpointBehavior();
        }

        public override Type BehaviorType
        {
            get { return typeof(XmlRpcEndpointBehavior); }
        }
    }
}

After, I created my interface for Xml-Rpc :

namespace WsZendesk
{
    [ServiceContract]
    public interface IWsZendeskRpc
    {
        [OperationContract(Action = "wszendesk.GetUserIdFromBarcode")]
        void GetUserIdFromBarcode(String sXmlIn, out String sXmlOut);
    }
}

Finaly, I modified my web.config in order to allow RPC :

  <system.serviceModel>
    <services>
      <service name="WsZendesk.WsZendesk" behaviorConfiguration="WsZendeskServiceBehavior">
        <endpoint address="rest" behaviorConfiguration="restfulBehavior"
          binding="webHttpBinding" bindingConfiguration="" name="RESTEndPoint"
          contract="WsZendesk.IWsZendeskRest" />
        <endpoint address="xmlrpc" behaviorConfiguration="xmlRpcBehavior"
          binding="webHttpBinding" bindingConfiguration="" name="RPCEndPoint"
          contract="WsZendesk.IWsZendeskRpc" />
        <endpoint address="" behaviorConfiguration=""
          binding="basicHttpBinding" bindingConfiguration="" name="SOAPEndPoint"
          contract="WsZendesk.IWsZendesk" />
      </service>
    </services>
    <extensions>
      <behaviorExtensions>
        <add name="xmlRpc"
             type="WsZendesk.XmlRpcEndpointBehaviorElement, WsZendesk" />
      </behaviorExtensions>
    </extensions>
    <behaviors>
      <endpointBehaviors>
        <behavior name="restfulBehavior">
          <webHttp />
        </behavior>
        <behavior name="xmlRpcBehavior">
          <xmlRpc />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="WsZendeskServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

Visual Studio said he don't know the child element 'xmlRpc'. So, when I try to launch my webservice, the same error appears during the execution.

error in Visual Studio

error during execution

Anybody can help me to use Xml-Rpc with my existing webservice ?

For information, my project is in C# 4.



Solution 1:[1]

It was not this:

<add name="xmlRpc"
type="WsZendesk.XmlRpcEndpointBehaviorElement, WsZendesk" />

But this:

<add name="xmlRpc"
             type="WsZendesk.XmlRpcEndpointBehaviorExtension, WsZendesk" />

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vinzee