views:

281

answers:

2

I have a WCF service service scenario like this

namespace Company.BO.Contracts {

public interface ITypeService  {  }

public partial interface IType1Services : ITypeService  
{
 [OperationContract()]
 Type1 GetType1(System.Int32 idValue);

 [OperationContract()]
 Type1 Save(Type1 myType1, System.Int32 changeUser);
}

public partial interface IType2Services : ITypeService  
{
 [OperationContract()]
 Type2 GetType2(System.Int32 idValue);

 [OperationContract()]
 Type2 Save(Type2 type2, System.Int32 changeUser);
}

}

namespace Company.ContractFulfillment {

public class Type1Services : IType1Services
{
 public MyType1 GetType1(System.Int32 idValue)
 {
  return new Type1();
 }
}

public class Type2Services : IType2Services
{
 public Type2 GetType2(System.Int32 idValue)
 {
  return new Type2();
 }
}

}

When I expose the above code as WCF service, BizTalk is not able to distiguish between Type1.Save() and Type2.Save(). Is there a way without modifying the service, coz the service is part of a framework and requires more changes at other dependent places?

For clients other than BizTalk, the service access layer is wrapped into type library (type1, type2 etc) and clients access this type library as normal class library.

A: 

Can you put a [ServiceContractAttribute(Namespace="http://company.com/services/type1/")] on the type 1 interface? Use a different namespace for each service contract, since they are different contracts.

John Saunders
2nd - Different namespace for each service contract isn't possible coz, these are from an in place framework; modifying the namespace will collapse other apps, which are consuming the services. The biztalk is latest intitiative to integrate with another relatively new system. 1st - All the types (type1 ...n) are exposed with Services.Core namespace and specific name as below.[ServiceContract(Namespace = "http://company.com/services/core", Name = "Type1 Interface")]
Muralidhar
A: 

You could build a WCF service that you placed between the framework and Biztalk

Implement Type1.Save() as Type1.SaveType1() in this new service.

Not particularly elegant but it would work.

Shiraz Bhaiji
Indeed, we are doing the same. But, I feel this is redundant.I found another implementation using custom pipellnes , which will allow me to change the source and target namespaces (using some .net assembly with 2 properties for source and target namespaces) and set them to the schema and port configuration. But, when more datacontracts are exposed and the no. of orchestrations grow high, this is hard to maintain and tweak, if something goes wrong (High maintenance aspect!).
Muralidhar