Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think I found the reason for it. In the WSDL the function gets exposed as the following:</p> <pre><code>&lt;wsdl:message name="IBusinessUnitDAO_GetBusinessUnitProjects_InputMessage"&gt; &lt;wsdl:part name="parameters" element="tns:GetBusinessUnitProjects" /&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="IBusinessFunctionDAO_GetBusinessFunctionProjects_InputMessage"&gt; &lt;wsdl:part name="parameters" element="tns:GetBusinessFunctionProjects" /&gt; &lt;/wsdl:message&gt; </code></pre> <p>Then in the xsd that defines the tns: namespace we have the following:</p> <pre><code>&lt;xs:element name="GetBusinessUnitProjects"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="businessUnitRefID" type="xs:int" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="GetBusinessFunctionProjects"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="businessFunctionRefID" type="xs:int" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; </code></pre> <p>So the reason for the collision even though the the service is exposing two different contracts is because all of the wsdl part elements are in the same namespace. So when you create two function names that are identical you get duplicate elements with the same name which causes the problem. So the solution to the problem is to add a namespace attribute to each service contract. If we take our original service contract and modify it like so.</p> <pre><code>[ServiceContract(Namespace="Tracking/BusinessFunction")] public partial interface IBusinessFunctionDAO { [OperationContract] BusinessFunction GetBusinessFunction(Int32 businessFunctionRefID); [OperationContract] IEnumerable&lt;Project&gt; GetProjects(Int32 businessFunctionRefID); } [ServiceContract(Namespace="Tracking/BusinessUnit")] public partial interface IBusinessUnitDAO { [OperationContract] BusinessUnit GetBusinessUnit(Int32 businessUnitRefID); [OperationContract] IEnumerable&lt;Project&gt; GetProjects(Int32 businessUnitRefID); } </code></pre> <p>When we generate the WSDL we get a WSDL for each namespace we create. This namespace has each port identified with all its operations and elements. So inside each of our seperate WSDL's we get the following:</p> <pre><code>//File: Tracking.BusinessFunction.wsdl &lt;wsdl:message name="IBusinessFunctionDAO_GetProjects_InputMessage"&gt; &lt;wsdl:part name="parameters" element="tns:GetProjects" /&gt; &lt;/wsdl:message&gt; //File: Tracking.BusinessUnit.wsdl &lt;wsdl:message name="IBusinessUnitDAO_GetProjects_InputMessage"&gt; &lt;wsdl:part name="parameters" element="tns:GetProjects" /&gt; &lt;/wsdl:message&gt; </code></pre> <p>as you can see they both have the same element name, but because they are in different namespaces the elements no longer conflict with each other. If we take a look at the xsd they now have the same elements defined but with different parameters:</p> <pre><code>//File: Tracking.BusinessFunction.xsd &lt;xs:element name="GetProjects"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="businessFunctionRefID" type="xs:int" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; //File: Tracking.BusinessUnit.xsd &lt;xs:element name="GetProjects"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="businessUnitRefID" type="xs:int" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; </code></pre> <p>So the answer to my original question is to make each service contract live in a separate namespace so you don't have conflicting port elements. This also gives you the flexibility of having your contracts in separate WSDL's which are easier to manage if you are distributing parts of them.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload