in

CodeSmith Community

Your Code. Your Way. Faster!

Generating a web service layer for a winforms app

Last post 11-27-2006 1:45 PM by needbrew. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-17-2006 3:35 PM

    • needbrew
    • Top 150 Contributor
    • Joined on 03-20-2006
    • Posts 38
    • Points 1,180

    Generating a web service layer for a winforms app

    Hi All,

     

    I am trying to generate a web service layer using the ServiceLayer option but cannot seem to get it to work.  The code generates fine, but how to you use it from a winfroms client.  I added a web reference to it, but there does not seem to be and services like there is if you use it with out the web service layer?  It would be nice if there was a complete walkthrough of a winfrom client with no web, with a web service layer, and and WCF layer as well as the web examples.

     

    Keep up the good work. 

     

    Thanks

    Mike

    Filed under:
    • Post Points: 35
  • 11-18-2006 2:58 PM In reply to

    • madpeter
    • Top 150 Contributor
    • Joined on 03-10-2004
    • Posts 35
    • Points 815

    Re: Generating a web service layer for a winforms app

    Hi Mike

    You can add the WebServiceClient to your app, add the following to your app.config

     <netTiers.Petshop.Data defaultProvider="WsNetTiersProvider">
      <providers>
       <!--
        *** WebserviceClient Provider ***
        The url parameter indicates the webservices url (ex: http://localhost/netTiers.Petshop/netTiers.PetshopServices.aspx)
    -->
        <add
         name="WsNetTiersProvider"
         type="netTiers.Petshop.Data.WebServiceClient.WsNetTiersProvider, netTiers.Petshop.Data.WebServiceClient"
         url="/netTiers.PetshopServices.asmx" />
         </providers>
     </netTiers.Petshop.Data>

    and then use the WebServiceClient like the normal provider-

    TList<Customer> list = DataRepository.CustomerProvider.GetAll();

    Peter

    • Post Points: 35
  • 11-20-2006 8:08 AM In reply to

    • needbrew
    • Top 150 Contributor
    • Joined on 03-20-2006
    • Posts 38
    • Points 1,180

    Re: Generating a web service layer for a winforms app

    Do you need to add the web reference to the winform app?  There must be a using or a reference that is needed isn't there?

     

    Thanks

    • Post Points: 35
  • 11-20-2006 1:09 PM In reply to

    • madpeter
    • Top 150 Contributor
    • Joined on 03-10-2004
    • Posts 35
    • Points 815

    Re: Generating a web service layer for a winforms app

    Hi

    In your winform app you set a normal reference to the WebServerClient (dll). In the App.config you set the configuration as in the last post(ie the WsNetTiersProvider ) Then from your windows app you use the DataRepository and the individual entity providers.

    Peter

    • Post Points: 35
  • 11-20-2006 3:09 PM In reply to

    • needbrew
    • Top 150 Contributor
    • Joined on 03-20-2006
    • Posts 38
    • Points 1,180

    Re: Generating a web service layer for a winforms app

    The WebServiceClient does not build correctly.  I get an error stating the following

    Error 8 Source file 'C:\NetTiers\research\research.Data.WebServiceClient\Web References\WsProxy\Reference.cs' could not be opened ('The system cannot find the file specified. ') research.Data.WebServiceClient

    Any Ideas?

    • Post Points: 35
  • 11-21-2006 2:24 AM In reply to

    • Lex
    • Top 50 Contributor
    • Joined on 09-28-2006
    • Posts 72
    • Points 1,945

    Re: Generating a web service layer for a winforms app

    needbrew :

    - compile and publish the web service project
    - update the web reference in the WebServiceClient, pointing to the web service URL
    - now you can compile the WebServiceClient

    • Post Points: 35
  • 11-27-2006 1:45 PM In reply to

    • needbrew
    • Top 150 Contributor
    • Joined on 03-20-2006
    • Posts 38
    • Points 1,180

    Re: Generating a web service layer for a winforms app

    HI,

     

    I did the steps you outlined but am now getting the following error in the WebServiceClient Project when I try to compile it.

     Error 1 The type or namespace name 'researchServices' does not exist in the namespace 'research.DAL.WebServiceClient.WsProxy' (are you missing an assembly reference?) C:\Nettiers\research\research.DAL.WebServiceClient\WsDraResponseTypesProvider.generated.cs 162 13 research.DAL.WebServiceClient

     

    It appears that the name "researchServices" should be "ResearchServices".  Not sure why but if I change all the references to that it compiles.

     

    Thanks

     Mike

    • Post Points: 5
Page 1 of 1 (7 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems