SA Developer .NET

Welcome to SA Developer .NET Sign in | Join | Help
in Search

Web Service and pocket pc

Last post 07-24-2008, 13:56 by riaans. 8 replies.
Sort Posts: Previous Next
  •  07-16-2008, 9:58 13396

    Web Service and pocket pc

    I have recently completed a project where I connect to a database via a web service running on the same machine as the DB. I have compiled the "service.asmx" with WSDL.exe and CSC.exe into a dll because i want to protect the code in the service. 

     I reference the dll as normal but I can only access the public structs I have created in the web service, the public web methods are not exposed when I declare a variable as my web dll. Have I done something wrong? Is there something that needs to change? 

    I can access the public web methods if I import namespace like this : "Imports wserv.service" but then it still needs the "Service.vb" which includes all your source code. That seems a bit risky! Any other way?

  •  07-16-2008, 10:05 13397 in reply to 13396

    Re: Web Service and pocket pc

    I'm not sure if this will help, but have you added the [WebMethod] attribute to your methods in your service?

    http://msdn.microsoft.com/en-us/library/byxd99hx(VS.71).aspx

    http://en.csharp-online.net/Creating_ASP.NET_Web_Services%E2%80%94The_WebMethod_Attribute


    "I would love to change the world, but they won't give me the source code"
    SMS your TO DO list to your email
  •  07-16-2008, 10:17 13399 in reply to 13397

    Re: Web Service and pocket pc

    All my web methods  are declared as e.g

    "<WebMethod()> _
      Public Function GetDate(CurrDate as Date) As String"

     Thank you for the suggestion and links. How does one protect your code on the server machine? It cannot be that difficult!

     

  •  07-16-2008, 10:27 13400 in reply to 13399

    Re: Web Service and pocket pc

    By protecting the code you mean you don't want other developers / people who have access to the server to be able to see the code?

    As far as I know you can't "protect" code without using a some sort of third party tool that obfuscates the code... google "c# obfuscate code" and you'll get links to products that do that sort of thing.


    "I would love to change the world, but they won't give me the source code"
    SMS your TO DO list to your email
  •  07-16-2008, 10:38 13402 in reply to 13400

    Re: Web Service and pocket pc

    A Web service creates an App_Code directory which contains "Service.vb" file which has all your code in it that is used to access the DB. Don't want ppl to get their claws on that. This web service will be running at locations out of our control.
  •  07-16-2008, 10:46 13403 in reply to 13402

    Re: Web Service and pocket pc

    Oh, now I get it... well have tried adding a web deployment project, then building your solution in Release mode and copying only the files from the web deployment project folder? Those shouldn't have any actual code, everything should be DLL's... I think...

    "I would love to change the world, but they won't give me the source code"
    SMS your TO DO list to your email
  •  07-23-2008, 12:16 13607 in reply to 13396

    Re: Web Service and pocket pc

    The other option is to run SQL Soap Endpoints, if the web service needs to be on the SQL Server. That would probably be the best option.
  •  07-24-2008, 8:31 13631 in reply to 13607

    Re: Web Service and pocket pc

    Figured it out thanks to MSDN forums. The web service needs to be published inside VS 2005. A directory  is created and inside that you have a bin directory with : App_Code.dll which is the replacement for your service.vb file (which contains source code). You just replace the app_code directory with the App_Code.dll in the web service directory and it works like a charm!

     

    Thank you for everyones help and suggestions.

  •  07-24-2008, 13:56 13649 in reply to 13396

    Re: Web Service and pocket pc

    Glad you sorted. Good one to know!
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems