Adding web reference to a windows service

Discussion in 'ASP .Net Web Services' started by CyberLotus, Dec 10, 2004.

  1. CyberLotus

    CyberLotus Guest

    Hi,

    I've created a windows service (basically a polling service involving MSMQ)
    and created a web service too in C#. Now in the windows service, I want to
    give a reference to the web service.

    I tried in usual manner, as described below:
    1. In the solution explorer of windows service, I added a reference to the
    web service.
    2. Then, in the using section of windows service, I added, "using
    <namespace>.<web ref name>". (though the web ref name was not showing after
    putting the dot).
    3. I created an object of the web service's class in windows service and
    tried to access the web methods.

    But this didn't work. It gave me the following build error: "The type or
    namespace name 'GetFilesWS' does not exist in the class or namespace
    'Knot.WeddingWarehouse.Interface.MSMQWindowsService' (are you missing an
    assembly reference?)".

    where 'GetFilesWS' is the <web ref name> and
    'Knot.WeddingWarehouse.Interface.MSMQWindowsService' is the <namespace>.

    Can anybody give me any clue on this.
    TIA.
    - CyberLotus
    CyberLotus, Dec 10, 2004
    #1
    1. Advertising

  2. CyberLotus

    Dan Rogers Guest

    Did you reference the service class via add-reference? Or as
    add-web-reference?

    If you want to make a web service call, you use add-web-reference. This
    creates a proxy which has it's own namespace.

    If you used add-reference (to make a direct link), then you just need to
    make sure the reference got added, is spelled correctly, etc.

    Hope this helps

    Dan Rogers
    Microsoft Corporation
    --------------------
    >Thread-Topic: Adding web reference to a windows service
    >thread-index: AcTek7S+Zw0M0I4ISDi+hcSMSabUnw==
    >X-WBNR-Posting-Host: 220.227.179.5
    >From: "=?Utf-8?B?Q3liZXJMb3R1cw==?=" <>
    >Subject: Adding web reference to a windows service
    >Date: Fri, 10 Dec 2004 00:39:04 -0800
    >Lines: 26
    >Message-ID: <>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="Utf-8"
    >Content-Transfer-Encoding: 7bit
    >X-Newsreader: Microsoft CDO for Windows 2000
    >Content-Class: urn:content-classes:message
    >Importance: normal
    >Priority: normal
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
    >Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
    >Xref: cpmsftngxa10.phx.gbl

    microsoft.public.dotnet.framework.aspnet.webservices:27127
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >
    >Hi,
    >
    >I've created a windows service (basically a polling service involving

    MSMQ)
    >and created a web service too in C#. Now in the windows service, I want to
    >give a reference to the web service.
    >
    >I tried in usual manner, as described below:
    >1. In the solution explorer of windows service, I added a reference to the
    >web service.
    >2. Then, in the using section of windows service, I added, "using
    ><namespace>.<web ref name>". (though the web ref name was not showing

    after
    >putting the dot).
    >3. I created an object of the web service's class in windows service and
    >tried to access the web methods.
    >
    >But this didn't work. It gave me the following build error: "The type or
    >namespace name 'GetFilesWS' does not exist in the class or namespace
    >'Knot.WeddingWarehouse.Interface.MSMQWindowsService' (are you missing an
    >assembly reference?)".
    >
    >where 'GetFilesWS' is the <web ref name> and
    >'Knot.WeddingWarehouse.Interface.MSMQWindowsService' is the <namespace>.
    >
    >Can anybody give me any clue on this.
    >TIA.
    >- CyberLotus
    >
    Dan Rogers, Dec 10, 2004
    #2
    1. Advertising

  3. CyberLotus

    CyberLotus Guest

    How do I reference the service class of the web service to the windows service?

    So far my knowledge is concerned, I can only add the URL of my web service
    not the class.

    Please let me know. I'm stuck at this point for past 2 days.
    TIA.
    - CyberLotus



    "Dan Rogers" wrote:

    > Did you reference the service class via add-reference? Or as
    > add-web-reference?
    >
    > If you want to make a web service call, you use add-web-reference. This
    > creates a proxy which has it's own namespace.
    >
    > If you used add-reference (to make a direct link), then you just need to
    > make sure the reference got added, is spelled correctly, etc.
    >
    > Hope this helps
    >
    > Dan Rogers
    > Microsoft Corporation
    > --------------------
    > >Thread-Topic: Adding web reference to a windows service
    > >thread-index: AcTek7S+Zw0M0I4ISDi+hcSMSabUnw==
    > >X-WBNR-Posting-Host: 220.227.179.5
    > >From: "=?Utf-8?B?Q3liZXJMb3R1cw==?=" <>
    > >Subject: Adding web reference to a windows service
    > >Date: Fri, 10 Dec 2004 00:39:04 -0800
    > >Lines: 26
    > >Message-ID: <>
    > >MIME-Version: 1.0
    > >Content-Type: text/plain;
    > > charset="Utf-8"
    > >Content-Transfer-Encoding: 7bit
    > >X-Newsreader: Microsoft CDO for Windows 2000
    > >Content-Class: urn:content-classes:message
    > >Importance: normal
    > >Priority: normal
    > >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
    > >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    > >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
    > >Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
    > >Xref: cpmsftngxa10.phx.gbl

    > microsoft.public.dotnet.framework.aspnet.webservices:27127
    > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    > >
    > >Hi,
    > >
    > >I've created a windows service (basically a polling service involving

    > MSMQ)
    > >and created a web service too in C#. Now in the windows service, I want to
    > >give a reference to the web service.
    > >
    > >I tried in usual manner, as described below:
    > >1. In the solution explorer of windows service, I added a reference to the
    > >web service.
    > >2. Then, in the using section of windows service, I added, "using
    > ><namespace>.<web ref name>". (though the web ref name was not showing

    > after
    > >putting the dot).
    > >3. I created an object of the web service's class in windows service and
    > >tried to access the web methods.
    > >
    > >But this didn't work. It gave me the following build error: "The type or
    > >namespace name 'GetFilesWS' does not exist in the class or namespace
    > >'Knot.WeddingWarehouse.Interface.MSMQWindowsService' (are you missing an
    > >assembly reference?)".
    > >
    > >where 'GetFilesWS' is the <web ref name> and
    > >'Knot.WeddingWarehouse.Interface.MSMQWindowsService' is the <namespace>.
    > >
    > >Can anybody give me any clue on this.
    > >TIA.
    > >- CyberLotus
    > >

    >
    >
    CyberLotus, Dec 13, 2004
    #3
  4. CyberLotus

    Mujtaba Syed Guest

    Hi:

    The web service will be in an ASP.NET project, so it will be available as a
    URL (for eg. http://your-server.com/app-name/webservice1.asmx)
    In your VS.NET windows service project when you add web reference, you will
    need to provide this same URL. VS.NET will download the WSDL of this service
    and create a proxy (a class). This proxy resides in a file called
    Reference.cs. You can use the web service from the windows service by
    instantiating this class and invoking its methods.

    Hope this helps,
    Mujtaba.

    "CyberLotus" <> wrote in message
    news:...
    > How do I reference the service class of the web service to the windows

    service?
    >
    > So far my knowledge is concerned, I can only add the URL of my web service
    > not the class.
    >
    > Please let me know. I'm stuck at this point for past 2 days.
    > TIA.
    > - CyberLotus
    >
    >
    >
    > "Dan Rogers" wrote:
    >
    > > Did you reference the service class via add-reference? Or as
    > > add-web-reference?
    > >
    > > If you want to make a web service call, you use add-web-reference. This
    > > creates a proxy which has it's own namespace.
    > >
    > > If you used add-reference (to make a direct link), then you just need to
    > > make sure the reference got added, is spelled correctly, etc.
    > >
    > > Hope this helps
    > >
    > > Dan Rogers
    > > Microsoft Corporation
    > > --------------------
    > > >Thread-Topic: Adding web reference to a windows service
    > > >thread-index: AcTek7S+Zw0M0I4ISDi+hcSMSabUnw==
    > > >X-WBNR-Posting-Host: 220.227.179.5
    > > >From: "=?Utf-8?B?Q3liZXJMb3R1cw==?="

    <>
    > > >Subject: Adding web reference to a windows service
    > > >Date: Fri, 10 Dec 2004 00:39:04 -0800
    > > >Lines: 26
    > > >Message-ID: <>
    > > >MIME-Version: 1.0
    > > >Content-Type: text/plain;
    > > > charset="Utf-8"
    > > >Content-Transfer-Encoding: 7bit
    > > >X-Newsreader: Microsoft CDO for Windows 2000
    > > >Content-Class: urn:content-classes:message
    > > >Importance: normal
    > > >Priority: normal
    > > >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
    > > >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    > > >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
    > > >Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
    > > >Xref: cpmsftngxa10.phx.gbl

    > > microsoft.public.dotnet.framework.aspnet.webservices:27127
    > > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    > > >
    > > >Hi,
    > > >
    > > >I've created a windows service (basically a polling service involving

    > > MSMQ)
    > > >and created a web service too in C#. Now in the windows service, I want

    to
    > > >give a reference to the web service.
    > > >
    > > >I tried in usual manner, as described below:
    > > >1. In the solution explorer of windows service, I added a reference to

    the
    > > >web service.
    > > >2. Then, in the using section of windows service, I added, "using
    > > ><namespace>.<web ref name>". (though the web ref name was not showing

    > > after
    > > >putting the dot).
    > > >3. I created an object of the web service's class in windows service

    and
    > > >tried to access the web methods.
    > > >
    > > >But this didn't work. It gave me the following build error: "The type

    or
    > > >namespace name 'GetFilesWS' does not exist in the class or namespace
    > > >'Knot.WeddingWarehouse.Interface.MSMQWindowsService' (are you missing

    an
    > > >assembly reference?)".
    > > >
    > > >where 'GetFilesWS' is the <web ref name> and
    > > >'Knot.WeddingWarehouse.Interface.MSMQWindowsService' is the

    <namespace>.
    > > >
    > > >Can anybody give me any clue on this.
    > > >TIA.
    > > >- CyberLotus
    > > >

    > >
    > >
    Mujtaba Syed, Dec 13, 2004
    #4
  5. CyberLotus

    Dan Rogers Guest

    Hi,

    I have no idea what you just said...


    >
    >How do I reference the service class of the web service to the windows

    service?
    >
    >


    But, there are only two kinds of references. One is including a strong
    link to the dll where the implementation is. The other is by using a proxy
    to reference the remote implementation via an XML wire based interchange.

    For the former, you would do "add reference". For the latter, you would do
    "add web reference".

    I wish I could say it in a clearer way to help you (I know, I already wrote
    this).

    Dan
    Dan Rogers, Dec 13, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kiran
    Replies:
    3
    Views:
    755
  2. cindy
    Replies:
    0
    Views:
    482
    cindy
    Aug 14, 2009
  3. wawa_piggy

    Adding a web reference to a java web service

    wawa_piggy, Apr 19, 2004, in forum: ASP .Net Web Services
    Replies:
    5
    Views:
    170
    Dino Chiesa [Microsoft]
    Apr 22, 2004
  4. only_me

    vs2005 consuming web service, adding web reference ?

    only_me, Sep 20, 2005, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    201
    only_me
    Sep 25, 2005
  5. Trouble adding web service reference

    , Apr 26, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    134
Loading...

Share This Page