Answered Two services using same contract

  • Tuesday, March 06, 2012 8:43 PM
     
     

    Hello.  We have a WCF service calling another WCF service.  Both have the same interface and data contracts.

    I have imported his service reference and can make the appropriate calls to get the information I want.  The issue comes when I try to convert his GetUser request to my GetUser request.  I receive an error "Cannot convert Namespace.ServiceReference.UserResponse to Namespace.UserResponse.'

    I'm hoping there is a solution other than creating a UserResponse and filling all the values using the ServiceReference.UserResponse.

    Thanks much!!!


    • Edited by Hiline1961 Tuesday, March 06, 2012 11:17 PM
    •  

All Replies

  • Wednesday, March 07, 2012 1:04 AM
     
     Answered

    There are two UserResponse types in your scenario. I assume the error you mentioned is a compilation error and not a runtime error. The best way to work around this problem is to define UserResponse (and any other shared types) and place them in their own assembly. Reference the shared assembly from both services and you should be able to use the same type in both places.

    I hope this helps,

    Michael Green
    WCF Documentation Team