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. Private Webservice

Private Webservice

Scheduled Pinned Locked Moved C#
xmlcsharpc++databasewcf
6 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.
  • L Offline
    L Offline
    ldaoust
    wrote on last edited by
    #1

    I have a c++ application that needs to retrieve information from my company's server. I decided to build a c# webservice. So far it works fine. I need to add some security since I pass userid and password. But my main concern is that this webservice will only be used by our applications and I don't want it to be public to others, so that they cannot view the schema and cannot see the page that shows how to make a HTTP GET/POST and SOAP request. Is there a way to make the webservice not available to public ? or at least hide the schema/request pages ?

    H L 2 Replies Last reply
    0
    • L ldaoust

      I have a c++ application that needs to retrieve information from my company's server. I decided to build a c# webservice. So far it works fine. I need to add some security since I pass userid and password. But my main concern is that this webservice will only be used by our applications and I don't want it to be public to others, so that they cannot view the schema and cannot see the page that shows how to make a HTTP GET/POST and SOAP request. Is there a way to make the webservice not available to public ? or at least hide the schema/request pages ?

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      If you're looking to add security to your web services, take a look at the Microsoft Web Service Enhancements (WSE)[^]. 2.0 was recently released. With a few simple changes to your server and clients, you can use strong authentication protocols (or a simple username/password, though I recommend at least hashing the password using MD5 or SHA1, which is easily supported by the WSE), encryption, signatures, addressing (routing), etc. If you want it private, simply don't expose it to the public. Unless it needs to be on your Internet web server, just use it on your intranet. If you need to put it on your Internet server (say, for an extranet) then use IP address blocking (IIS feature) or features in the WSE. The latter won't prevent them from seeing the WSDL, but unless your business is about the WSDL schema and not the data that's transferred, this really shouldn't be a problem.

      Microsoft MVP, Visual C# My Articles

      L 1 Reply Last reply
      0
      • H Heath Stewart

        If you're looking to add security to your web services, take a look at the Microsoft Web Service Enhancements (WSE)[^]. 2.0 was recently released. With a few simple changes to your server and clients, you can use strong authentication protocols (or a simple username/password, though I recommend at least hashing the password using MD5 or SHA1, which is easily supported by the WSE), encryption, signatures, addressing (routing), etc. If you want it private, simply don't expose it to the public. Unless it needs to be on your Internet web server, just use it on your intranet. If you need to put it on your Internet server (say, for an extranet) then use IP address blocking (IIS feature) or features in the WSE. The latter won't prevent them from seeing the WSDL, but unless your business is about the WSDL schema and not the data that's transferred, this really shouldn't be a problem.

        Microsoft MVP, Visual C# My Articles

        L Offline
        L Offline
        ldaoust
        wrote on last edited by
        #3

        Heath Stewart wrote: If you're looking to add security to your web services, take a look at the Microsoft Web Service Enhancements (WSE)[^]. The client application is built under VC++ 6.0. So, for now I am using sockets to connnect and retrieve the information. I was thinking about using SSL socket. I think there are some examples on codeproject. Heath Stewart wrote: If you want it private, simply don't expose it to the public. Unless it needs to be on your Internet web server, just use it on your intranet The client application is a Windows application that access the service through the Internet. It connects to our company's Web server and retrieve some data to process/display. My main concern is that service should only be available to the client applications and not to the public. If I could hide the shema returned when you point a browser to the .asmx file, that would be a good start. Then there is the ?WSDL. It looks like there is no easy way and will have to write a .ASP page which does basically the same thing. The problem is returning the XML code, with a webservice it's all very easy. Possible solution: Have the .ASP page call the webservice, which would not be public, and simple return the data. The .ASP would just act as a bridge between client and webservice.

        H 1 Reply Last reply
        0
        • L ldaoust

          Heath Stewart wrote: If you're looking to add security to your web services, take a look at the Microsoft Web Service Enhancements (WSE)[^]. The client application is built under VC++ 6.0. So, for now I am using sockets to connnect and retrieve the information. I was thinking about using SSL socket. I think there are some examples on codeproject. Heath Stewart wrote: If you want it private, simply don't expose it to the public. Unless it needs to be on your Internet web server, just use it on your intranet The client application is a Windows application that access the service through the Internet. It connects to our company's Web server and retrieve some data to process/display. My main concern is that service should only be available to the client applications and not to the public. If I could hide the shema returned when you point a browser to the .asmx file, that would be a good start. Then there is the ?WSDL. It looks like there is no easy way and will have to write a .ASP page which does basically the same thing. The problem is returning the XML code, with a webservice it's all very easy. Possible solution: Have the .ASP page call the webservice, which would not be public, and simple return the data. The .ASP would just act as a bridge between client and webservice.

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Everything from handling requests to .asmx?WSDL to generating the WSDL itself (as well as the "human-readable" HTML output for a service) is configurable. Spend some time reading the class library documentation for the System.Web.Services and child namespaces.

          Microsoft MVP, Visual C# My Articles

          1 Reply Last reply
          0
          • L ldaoust

            I have a c++ application that needs to retrieve information from my company's server. I decided to build a c# webservice. So far it works fine. I need to add some security since I pass userid and password. But my main concern is that this webservice will only be used by our applications and I don't want it to be public to others, so that they cannot view the schema and cannot see the page that shows how to make a HTTP GET/POST and SOAP request. Is there a way to make the webservice not available to public ? or at least hide the schema/request pages ?

            L Offline
            L Offline
            ldaoust
            wrote on last edited by
            #5

            Here's what I found: Since this webservice will only be used by some client applications that already knows the schema, to hide the documentation of the web service, there is a key that can be set in the web.config file. <?xmlversion="1.0" encoding="utf-8"?> < <webServices> <protocols> <remove name="Documentation"/> </protocols> </webServices> </system.web> </configuration>

            L 1 Reply Last reply
            0
            • L ldaoust

              Here's what I found: Since this webservice will only be used by some client applications that already knows the schema, to hide the documentation of the web service, there is a key that can be set in the web.config file. <?xmlversion="1.0" encoding="utf-8"?> < <webServices> <protocols> <remove name="Documentation"/> </protocols> </webServices> </system.web> </configuration>

              L Offline
              L Offline
              ldaoust
              wrote on last edited by
              #6

              You can also set a custom page to be displayed for the WSDL documentation:<?xmlversion="1.0"encoding="utf-8"?> <configuration> <system.web> <webServices> <wsdlHelpGeneratorhref="helpPage.aspx"/> </webService> </system.web> </configuration>
              It can also be a .html page. So you can display what ever you want. A third possibility is to process the request from Application_BeginRequest function. You can check if the request has a ?wsdl to it and throw a http exception. All these examples can be found here: http://www.15seconds.com/issue/040609.htm

              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