Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Hide web service details?

Hide web service details?

Scheduled Pinned Locked Moved C#
wcfalgorithmsjsonhelptutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark Tutt
    wrote on last edited by
    #1

    We're working on a project that goes against another application that exposes it's API via web services. Pretty cool, except for the complexity of actually getting anything done due to the interdependacy of the calls. So what we're doing is writing wrapper classes to abstract away the details to let people call a simple function that takes care of all the nitty gritty bits. Plus give us the future option of moving to another third party app by simply rewriting the wrappers. Now for the problem area... we want to hide the actual web service calls from the application programmers using our wrapper. Basically we want to try to prevent someone from going outside the sandbox and using the API directly, potentially causing problems with the app or future portability. With them referenced in the assembly, you can see them by default. I know it's probably basic, but haven't worked out how to make them private or internal. Someone got a pointer?

    F 1 Reply Last reply
    0
    • M Mark Tutt

      We're working on a project that goes against another application that exposes it's API via web services. Pretty cool, except for the complexity of actually getting anything done due to the interdependacy of the calls. So what we're doing is writing wrapper classes to abstract away the details to let people call a simple function that takes care of all the nitty gritty bits. Plus give us the future option of moving to another third party app by simply rewriting the wrappers. Now for the problem area... we want to hide the actual web service calls from the application programmers using our wrapper. Basically we want to try to prevent someone from going outside the sandbox and using the API directly, potentially causing problems with the app or future portability. With them referenced in the assembly, you can see them by default. I know it's probably basic, but haven't worked out how to make them private or internal. Someone got a pointer?

      F Offline
      F Offline
      Ferry Mulyono
      wrote on last edited by
      #2

      You can create this wrapper in an external project (into single DLL Assembly) to prevent programmers from seeing those. You can even obfuscate it to add more protection. But there is one thing I would suggest, is that are you sure the details (such as service address, WSDL, etc) won't change? If you're sure, then it's quite straight forward. But if you're not sure if the service address won't change, maybe you can "extract" the service address to be read from an external configuration. As for the WSDL uncertainty, I'm not quite sure about that, but maybe you can write your own WSDL&SOAP parser :) Hope it helps :) "If Mohammed won't go to the mountain, then the mountain must go to Mohammed" - Gil Grissom, CSI

      M 1 Reply Last reply
      0
      • F Ferry Mulyono

        You can create this wrapper in an external project (into single DLL Assembly) to prevent programmers from seeing those. You can even obfuscate it to add more protection. But there is one thing I would suggest, is that are you sure the details (such as service address, WSDL, etc) won't change? If you're sure, then it's quite straight forward. But if you're not sure if the service address won't change, maybe you can "extract" the service address to be read from an external configuration. As for the WSDL uncertainty, I'm not quite sure about that, but maybe you can write your own WSDL&SOAP parser :) Hope it helps :) "If Mohammed won't go to the mountain, then the mountain must go to Mohammed" - Gil Grissom, CSI

        M Offline
        M Offline
        Mark Tutt
        wrote on last edited by
        #3

        I'm afraid I don't follow. What we have currently is a single DLL wrapper project. That DLL has web references to the web services API of the other product. When a reference to the DLL is added to a client application, they not only see our wrapper functions, but also the raw service API as well. What we want to do is simply have them see our wrapper functions. The service address is driven by external configuration, but the autogenerated code from the WSDL generated by adding the web reference in our wrapper DLL is what we would ultimately like to hide.

        F 1 Reply Last reply
        0
        • M Mark Tutt

          I'm afraid I don't follow. What we have currently is a single DLL wrapper project. That DLL has web references to the web services API of the other product. When a reference to the DLL is added to a client application, they not only see our wrapper functions, but also the raw service API as well. What we want to do is simply have them see our wrapper functions. The service address is driven by external configuration, but the autogenerated code from the WSDL generated by adding the web reference in our wrapper DLL is what we would ultimately like to hide.

          F Offline
          F Offline
          Ferry Mulyono
          wrote on last edited by
          #4

          So you mean the automatically-generated code (by Visual Studio) is exposed automatically, and you want to hide this, and only expose facade class (that you made) to the client? In the DLL wrapper project, go to the Solution Explorer window, in the top click second icon from the left (It says "Shows All Files"). After that, you should be able to see in your Web References folder, you WS (which was one node only), now can be expanded. Try to expand it, and expand Reference.map, and you should file Reference.cs This cs file contains WS operation that we've been talking about. If you don't want to expose it, just change all class declaration here from public into internal. Therefore, only class in this wrapper DLL (in the same assembly) can access this. "If Mohammed won't go to the mountain, then the mountain must go to Mohammed" - Gil Grissom, CSI

          M 1 Reply Last reply
          0
          • F Ferry Mulyono

            So you mean the automatically-generated code (by Visual Studio) is exposed automatically, and you want to hide this, and only expose facade class (that you made) to the client? In the DLL wrapper project, go to the Solution Explorer window, in the top click second icon from the left (It says "Shows All Files"). After that, you should be able to see in your Web References folder, you WS (which was one node only), now can be expanded. Try to expand it, and expand Reference.map, and you should file Reference.cs This cs file contains WS operation that we've been talking about. If you don't want to expose it, just change all class declaration here from public into internal. Therefore, only class in this wrapper DLL (in the same assembly) can access this. "If Mohammed won't go to the mountain, then the mountain must go to Mohammed" - Gil Grissom, CSI

            M Offline
            M Offline
            Mark Tutt
            wrote on last edited by
            #5

            Looks like that might do it, thanks!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups