Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Adding web reference to a windows service

Reply
Thread Tools

Adding web reference to a windows service

 
 
CyberLotus
Guest
Posts: n/a
 
      12-10-2004
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.MSMQWindowsServic e' (are you missing an
assembly reference?)".

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

Can anybody give me any clue on this.
TIA.
- CyberLotus
 
Reply With Quote
 
 
 
 
Dan Rogers
Guest
Posts: n/a
 
      12-10-2004
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==?=" <(E-Mail Removed)>
>Subject: Adding web reference to a windows service
>Date: Fri, 10 Dec 2004 00:39:04 -0800
>Lines: 26
>Message-ID: <(E-Mail Removed)>
>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.webservic es
>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.webservic es:27127
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
>
>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.MSMQWindowsServi ce' (are you missing an
>assembly reference?)".
>
>where 'GetFilesWS' is the <web ref name> and
>'Knot.WeddingWarehouse.Interface.MSMQWindowsServi ce' is the <namespace>.
>
>Can anybody give me any clue on this.
>TIA.
>- CyberLotus
>


 
Reply With Quote
 
 
 
 
CyberLotus
Guest
Posts: n/a
 
      12-13-2004
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==?=" <(E-Mail Removed)>
> >Subject: Adding web reference to a windows service
> >Date: Fri, 10 Dec 2004 00:39:04 -0800
> >Lines: 26
> >Message-ID: <(E-Mail Removed)>
> >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.webservic es
> >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.webservic es:27127
> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
> >
> >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.MSMQWindowsServi ce' (are you missing an
> >assembly reference?)".
> >
> >where 'GetFilesWS' is the <web ref name> and
> >'Knot.WeddingWarehouse.Interface.MSMQWindowsServi ce' is the <namespace>.
> >
> >Can anybody give me any clue on this.
> >TIA.
> >- CyberLotus
> >

>
>

 
Reply With Quote
 
Mujtaba Syed
Guest
Posts: n/a
 
      12-13-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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==?="

<(E-Mail Removed)>
> > >Subject: Adding web reference to a windows service
> > >Date: Fri, 10 Dec 2004 00:39:04 -0800
> > >Lines: 26
> > >Message-ID: <(E-Mail Removed)>
> > >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.webservic es
> > >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.webservic es:27127
> > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
> > >
> > >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.MSMQWindowsServi ce' (are you missing

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

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

> >
> >



 
Reply With Quote
 
Dan Rogers
Guest
Posts: n/a
 
      12-13-2004
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error adding service reference in web part cindy ASP .Net 0 08-14-2009 12:22 AM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
vs2005 consuming web service, adding web reference ? only_me ASP .Net Web Services 2 09-25-2005 12:46 PM
Adding a web reference to a java web service wawa_piggy ASP .Net Web Services 5 04-22-2004 02:54 PM
Web service does not show up while adding web reference Kiran ASP .Net 3 08-22-2003 09:40 AM



Advertisments