1
Reply

CCW + WCF problem

guyjasper

guyjasper

Jun 23 2010 6:08 PM
2k
hi, please help me with my problem. basically i have a C# code for my web service, and a C# client that will consume the web service. both are working fine. the C# client has to be called by unmanaged code (VC 6.0) so i made a CCW for that. my C++ code can now call functions from my C# Client. the problem occurs when the unmanaged code calls a function from my C# client that in turn will call a function from the web service. i always get an Acess Denied error in my cpp code.

my C# client looks like this->

   [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
   public interface IMediaControllerClient
   {
      [DispId(1)]
      string ReserveItem(int StoreNo, int TerminalNo, int TransactionNo, string UPC);
   }

   [ClassInterface(ClassInterfaceType.None)]
   [ProgId("MediaController.MediaControllerClient")]
   public class MediaControllerClient : IMediaControllerClient
   {
      EndpointAddress m_adr;
      string m_sEndPointName = "";
      localhost.MediaControllerServiceClient proxy = null;

      public MediaControllerClient()
      {
         //Note values from settings file
         m_adr = new EndpointAddress("http://localhost:8081/MediaControllerService");
         m_sEndPointName = "BasicHttpBinding_MediaControllerService";

         //proxy = new localhost.MediaControllerServiceClient(m_sEndPointName, m_adr);
      }

      public string ReserveItem(int StoreNo, int TerminalNo, int TransactionNo, string UPC)
      {
         if(proxy==null)
            proxy = new localhost.MediaControllerServiceClient(m_sEndPointName, m_adr);

         localhost.MediaControllerServiceClient proxy = new localhost.MediaControllerServiceClient();
         try
         {
            return proxy.ReserveItem(StoreNo, TerminalNo, TransactionNo, UPC);
         }
         catch (EndpointNotFoundException ex)
         {
            return "<Error>";
         }
      }

Answers (1)