1
votes

Continuing this and this questions. I have two service contract with the same methods:

[ServiceContract]
public interface IServices1
{
    [OperationContract]
    string GetData(int value);
}

[ServiceContract]
public interface IServices2
{
    [OperationContract]
    string GetData(int value);
}

And service:

public class Service : IServices1, IServices2
{
    string IServices1.GetData(int value)
    {
        return string.Format("You entered: {0}", value);
    }

    string IServices2.GetData(int value)
    {
        return string.Format("You entered: {0}", value);
    }
}

According to reasons beyond my control:

System.NotSupportedException: A single WSDL document could not be generated for this service. Multiple service contract namespaces were found (IServices1, IServices2). Ensure that all your service contracts have the same namespace.

  • I need one service with several endpoints.
  • I need service like this (preferably on WCF).

Summarizing, I need WCF service with multiple service contracts with duplicate method names in single wsdl. Is there a way to achieve it?

1
You cannot do it, because it's equivalent to overload a method, and it isn't allowed in wsdl. See more here: stackoverflow.com/questions/10276124/… and here: w3.org/TR/2002/WD-wsdl12-20020709Ricardo Pontual
@RicardoPontual How can I get the wsdl like this with WCF? In this wsdl <portType name="RegistrationSoapPort"> have <operation name="AcceptRequest" parameterOrder="RequestID"> and <portType name="CertRequestSoapPort"> have <operation name="AcceptRequest" parameterOrder="RequestID Request"> in one namespace.Alexey
I posted as an answer because it was a little long for a commentRicardo Pontual
You must configure both endpoints in your Web. config, then it can also display the SingleWsdlnaro

1 Answers

1
votes

Generate your classes from the wsdl file. Save the content of http://pastebin.com/277DFF7H in a file, like "service.wsdl". Don't forget that <?xml version="1.0" encoding="UTF-8"?> tag must be at first like, first column.

Then run the wsdl.exe util from Developer Command Prompt , like this:

wsdl service.wsdl /out:service.cs

Now you have the contracts as wsdl requires, and you can do any changes you need.

Hope it helps.