By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

publishing Hello World to local IIS

P: n/a
cj
Perhaps someone knows how to do this. When I open a new ASP.NET web
service application in VS 2008, it opens with a simple Hello World web
service already written. I want to see this work. Without changing a
thing I built the solution and published it to localhost default web
site. How can I test it?????
Jan 7 '08 #1
Share this Question
Share on Google+
11 Replies


P: n/a

"cj" <cj@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Perhaps someone knows how to do this. When I open a new ASP.NET web
service application in VS 2008, it opens with a simple Hello World web
service already written. I want to see this work. Without changing a
thing I built the solution and published it to localhost default web site.
How can I test it?????
It's called consume a Web service using .Net. You can look it up, use
Google.

Jan 8 '08 #2

P: n/a
Hi Cj,

The ASP.NET webservice(asmx) should provide simple test page(for webmethd
with simple type parameters). For standard webservice test/use, you should
create a webservice client proxy (in the client project) and call the
webservice through proxy class. In .net project(with Visual Studio), it is
quite simple to create such a proxy, here are some reference that introduce
this:

#HOW TO: Write a Simple Web Service by Using Visual C# .NET
http://support.microsoft.com/kb/308359

#How to build and use XML Web services by using Visual Studio .NET or
Visual Studio 2005
http://support.microsoft.com/kb/315935/en-us

#Creating and Consuming .NET Web Services in Five Easy Steps
http://dotnetjunkies.com/Tutorial/4D...7B5757564.dcik

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Date: Mon, 07 Jan 2008 10:28:48 -0500
From: cj <cj@nospam.nospam>
Subject: publishing Hello World to local IIS
Message-ID: <#4**************@TK2MSFTNGP05.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices

Perhaps someone knows how to do this. When I open a new ASP.NET web
service application in VS 2008, it opens with a simple Hello World web
service already written. I want to see this work. Without changing a
thing I built the solution and published it to localhost default web
site. How can I test it?????

Jan 8 '08 #3

P: n/a
cj
Thanks! From one of your links, "Browse to the MathService.asmx Web
service page to test the Web service. If you set the local computer to
host the page, the URL is http://localhost/MathService/MathService.asmx."

That is what I was looking for.

I've been tied up with other priorties today so it'll probably be
tomorrow before I can test now.
Steven Cheng[MSFT] wrote:
Hi Cj,

The ASP.NET webservice(asmx) should provide simple test page(for webmethd
with simple type parameters). For standard webservice test/use, you should
create a webservice client proxy (in the client project) and call the
webservice through proxy class. In .net project(with Visual Studio), it is
quite simple to create such a proxy, here are some reference that introduce
this:

#HOW TO: Write a Simple Web Service by Using Visual C# .NET
http://support.microsoft.com/kb/308359

#How to build and use XML Web services by using Visual Studio .NET or
Visual Studio 2005
http://support.microsoft.com/kb/315935/en-us

#Creating and Consuming .NET Web Services in Five Easy Steps
http://dotnetjunkies.com/Tutorial/4D...7B5757564.dcik

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Date: Mon, 07 Jan 2008 10:28:48 -0500
From: cj <cj@nospam.nospam>
Subject: publishing Hello World to local IIS
Message-ID: <#4**************@TK2MSFTNGP05.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices

Perhaps someone knows how to do this. When I open a new ASP.NET web
service application in VS 2008, it opens with a simple Hello World web
service already written. I want to see this work. Without changing a
thing I built the solution and published it to localhost default web
site. How can I test it?????
Jan 8 '08 #4

P: n/a
No problem. Please feel free to post here if there is anything else need
help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Date: Tue, 08 Jan 2008 14:44:42 -0500
From: cj <cj@nospam.nospam>
Subject: Re: publishing Hello World to local IIS

Thanks! From one of your links, "Browse to the MathService.asmx Web
service page to test the Web service. If you set the local computer to
host the page, the URL is http://localhost/MathService/MathService.asmx."

That is what I was looking for.

I've been tied up with other priorties today so it'll probably be
tomorrow before I can test now.
Steven Cheng[MSFT] wrote:
Hi Cj,

The ASP.NET webservice(asmx) should provide simple test page(for webmethd
with simple type parameters). For standard webservice test/use, you
should
create a webservice client proxy (in the client project) and call the
webservice through proxy class. In .net project(with Visual Studio), it
is
quite simple to create such a proxy, here are some reference that
introduce
this:

#HOW TO: Write a Simple Web Service by Using Visual C# .NET
http://support.microsoft.com/kb/308359

#How to build and use XML Web services by using Visual Studio .NET or
Visual Studio 2005
http://support.microsoft.com/kb/315935/en-us

#Creating and Consuming .NET Web Services in Five Easy Steps
http://dotnetjunkies.com/Tutorial/4D...7B5757564.dcik
>
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
--------------------
Date: Mon, 07 Jan 2008 10:28:48 -0500
From: cj <cj@nospam.nospam>
Subject: publishing Hello World to local IIS
Message-ID: <#4**************@TK2MSFTNGP05.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices

Perhaps someone knows how to do this. When I open a new ASP.NET web
service application in VS 2008, it opens with a simple Hello World web
service already written. I want to see this work. Without changing a
thing I built the solution and published it to localhost default web
site. How can I test it?????
Jan 9 '08 #5

P: n/a
cj
I got time this AM to look at this some more. My project is named
MyTestWebService1 and saved it to the default web site on the local IIS.
The WebMethod is HelloWorld. I was kind of surprised I had to type
http://localhost/Service1.asmx into the browser. It did then show me
that HelloWorld was there and I could test it.

I guess my question is if I want to make a couple of web services should
I add another .asmx file to the project? Or should I add another
WebMethod to Service1.asmx? Or should I start a new project for the
second web service?

How is this generally done? I want to do it as simply as possible but
also would like to do it the way most people are used to using them.

Eventually we have a couple business partners that will need to use the
web services and I want it to be easy for them to use.

Thanks for your help.
Steven Cheng[MSFT] wrote:
No problem. Please feel free to post here if there is anything else need
help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Date: Tue, 08 Jan 2008 14:44:42 -0500
From: cj <cj@nospam.nospam>
Subject: Re: publishing Hello World to local IIS

Thanks! From one of your links, "Browse to the MathService.asmx Web
service page to test the Web service. If you set the local computer to
host the page, the URL is http://localhost/MathService/MathService.asmx."

That is what I was looking for.

I've been tied up with other priorties today so it'll probably be
tomorrow before I can test now.
Steven Cheng[MSFT] wrote:
>Hi Cj,

The ASP.NET webservice(asmx) should provide simple test page(for webmethd
with simple type parameters). For standard webservice test/use, you
should
>create a webservice client proxy (in the client project) and call the
webservice through proxy class. In .net project(with Visual Studio), it
is
>quite simple to create such a proxy, here are some reference that
introduce
>this:

#HOW TO: Write a Simple Web Service by Using Visual C# .NET
http://support.microsoft.com/kb/308359

#How to build and use XML Web services by using Visual Studio .NET or
Visual Studio 2005
http://support.microsoft.com/kb/315935/en-us

#Creating and Consuming .NET Web Services in Five Easy Steps
http://dotnetjunkies.com/Tutorial/4D...7B5757564.dcik
>Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

================================================= =

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
>up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.
>--------------------
Date: Mon, 07 Jan 2008 10:28:48 -0500
From: cj <cj@nospam.nospam>
Subject: publishing Hello World to local IIS
Message-ID: <#4**************@TK2MSFTNGP05.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices

Perhaps someone knows how to do this. When I open a new ASP.NET web
service application in VS 2008, it opens with a simple Hello World web
service already written. I want to see this work. Without changing a
thing I built the solution and published it to localhost default web
site. How can I test it?????
Jan 10 '08 #6

P: n/a
Hi Cj,

Glad that you've got progress. As for providing multiple webservices, I
think it is up to you that how to arrange those webservice
methods/endpoints.

If you have many service functions that belong to the same business logic,
you may group them in the same asmx service endpoint. Otherwise, you can
separate them into multiple webservice asmx endpoint. And you can create
separate webservice proxy classes for them.

In addition, if you want to make your client consumers easy to visit and
consume your service, I suggest you create a dedicated aspx web page which
grou p all the service's description page (...asmx?wsdl) on it (as
hyperlink). Thus, your clients can just visit that page and lookup all the
services you provided.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Date: Thu, 10 Jan 2008 11:14:15 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: Re: publishing Hello World to local IIS
I got time this AM to look at this some more. My project is named
MyTestWebService1 and saved it to the default web site on the local IIS.
The WebMethod is HelloWorld. I was kind of surprised I had to type
http://localhost/Service1.asmx into the browser. It did then show me
that HelloWorld was there and I could test it.

I guess my question is if I want to make a couple of web services should
I add another .asmx file to the project? Or should I add another
WebMethod to Service1.asmx? Or should I start a new project for the
second web service?

How is this generally done? I want to do it as simply as possible but
also would like to do it the way most people are used to using them.

Eventually we have a couple business partners that will need to use the
web services and I want it to be easy for them to use.

Thanks for your help.
Steven Cheng[MSFT] wrote:
Jan 14 '08 #7

P: n/a
cj
If I create a second class inside Service1.asmx it doesn't show in
http://localhost/Service1.asmx. I take it that is normal. I guess I'm
only allowed 1 class inside service1.asmx that will show and that class
must be named service1.asmx. Is this correct?

For instance in the below code http://localhost/Service1.asmx doesn't
show any of the Goodbye services. It does show HelloWorld and HelloCJ.

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET
AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()_
<System.Web.Services.WebService(Namespace:="http ://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)_
Public Class Service1
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function HelloWorld() As String
Return "Hello World"
End Function

<WebMethod()_
Public Function HelloCJ() As String
Return "Hello CJ"
End Function
End Class

<System.Web.Services.WebService(Namespace:="http ://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)_
Public Class Service2
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function GoodbyeWorld() As String
Return "Goodbye World"
End Function

<WebMethod()_
Public Function GoodbyeCJ() As String
Return "Goodbye CJ"
End Function
End Class

But even if I create a new service Service2.asmx inside the project and
put the goodbye code in it I can't get http://localhost/Service2.asmx
to bring up anything. I would have thought that would work.

Steven Cheng[MSFT] wrote:
Hi Cj,

Glad that you've got progress. As for providing multiple webservices, I
think it is up to you that how to arrange those webservice
methods/endpoints.

If you have many service functions that belong to the same business logic,
you may group them in the same asmx service endpoint. Otherwise, you can
separate them into multiple webservice asmx endpoint. And you can create
separate webservice proxy classes for them.

In addition, if you want to make your client consumers easy to visit and
consume your service, I suggest you create a dedicated aspx web page which
grou p all the service's description page (...asmx?wsdl) on it (as
hyperlink). Thus, your clients can just visit that page and lookup all the
services you provided.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Date: Thu, 10 Jan 2008 11:14:15 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: Re: publishing Hello World to local IIS
I got time this AM to look at this some more. My project is named
MyTestWebService1 and saved it to the default web site on the local IIS.
The WebMethod is HelloWorld. I was kind of surprised I had to type
http://localhost/Service1.asmx into the browser. It did then show me
that HelloWorld was there and I could test it.

I guess my question is if I want to make a couple of web services should
I add another .asmx file to the project? Or should I add another
WebMethod to Service1.asmx? Or should I start a new project for the
second web service?

How is this generally done? I want to do it as simply as possible but
also would like to do it the way most people are used to using them.

Eventually we have a couple business partners that will need to use the
web services and I want it to be easy for them to use.

Thanks for your help.
Steven Cheng[MSFT] wrote:
Jan 14 '08 #8

P: n/a
Hi Cj,

Yes, you should keep one webservice class in each asmx. Also, you can add
more than one classes in an asmx file(codebehind), however, the key point
is that only one of them should be marked as a "WebService", this is done
through the "WebServiceAttrribute"(the <WebService(....)in VB.NET). e.g.

<WebService("Name=.....")>
public class ServiceClass
{

}

Also, for each WebService method in it, you need to decorate it with
<WebMethodAttribute>

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Date: Mon, 14 Jan 2008 17:01:06 -0500
From: cj <cj@nospam.nospam>
Subject: Re: publishing Hello World to local IIS

If I create a second class inside Service1.asmx it doesn't show in
http://localhost/Service1.asmx. I take it that is normal. I guess I'm
only allowed 1 class inside service1.asmx that will show and that class
must be named service1.asmx. Is this correct?

For instance in the below code http://localhost/Service1.asmx doesn't
show any of the Goodbye services. It does show HelloWorld and HelloCJ.

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET
AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()_
<System.Web.Services.WebService(Namespace:="http ://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
_1)>
_
<ToolboxItem(False)_
Public Class Service1
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function HelloWorld() As String
Return "Hello World"
End Function

<WebMethod()_
Public Function HelloCJ() As String
Return "Hello CJ"
End Function
End Class

<System.Web.Services.WebService(Namespace:="http ://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
_1)>
_
<ToolboxItem(False)_
Public Class Service2
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function GoodbyeWorld() As String
Return "Goodbye World"
End Function

<WebMethod()_
Public Function GoodbyeCJ() As String
Return "Goodbye CJ"
End Function
End Class

But even if I create a new service Service2.asmx inside the project and
put the goodbye code in it I can't get http://localhost/Service2.asmx
to bring up anything. I would have thought that would work.

Steven Cheng[MSFT] wrote:
Hi Cj,

Glad that you've got progress. As for providing multiple webservices, I
think it is up to you that how to arrange those webservice
methods/endpoints.

If you have many service functions that belong to the same business
logic,
you may group them in the same asmx service endpoint. Otherwise, you can
separate them into multiple webservice asmx endpoint. And you can create
separate webservice proxy classes for them.

In addition, if you want to make your client consumers easy to visit and
consume your service, I suggest you create a dedicated aspx web page
which
grou p all the service's description page (...asmx?wsdl) on it (as
hyperlink). Thus, your clients can just visit that page and lookup all
the
services you provided.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
>

--------------------
Date: Thu, 10 Jan 2008 11:14:15 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: Re: publishing Hello World to local IIS

I got time this AM to look at this some more. My project is named
MyTestWebService1 and saved it to the default web site on the local IIS.
The WebMethod is HelloWorld. I was kind of surprised I had to type
http://localhost/Service1.asmx into the browser. It did then show me
that HelloWorld was there and I could test it.

I guess my question is if I want to make a couple of web services should
I add another .asmx file to the project? Or should I add another
WebMethod to Service1.asmx? Or should I start a new project for the
second web service?

How is this generally done? I want to do it as simply as possible but
also would like to do it the way most people are used to using them.

Eventually we have a couple business partners that will need to use the
web services and I want it to be easy for them to use.

Thanks for your help.
Steven Cheng[MSFT] wrote:
Jan 15 '08 #9

P: n/a
cj
I'm sorry but what do you mean by:

Also, for each WebService method in it, you need to decorate it with
<WebMethodAttribute>

Can you give me an example of where I would add that? Am I right in
that it is needed for remote access to the web service?

<System.Web.Services.WebService(Name:="CJ's Service",
Description:="Testing 123")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)_
Public Class Service1

Steven Cheng[MSFT] wrote:
Hi Cj,

Yes, you should keep one webservice class in each asmx. Also, you can add
more than one classes in an asmx file(codebehind), however, the key point
is that only one of them should be marked as a "WebService", this is done
through the "WebServiceAttrribute"(the <WebService(....)in VB.NET). e.g.

<WebService("Name=.....")>
public class ServiceClass
{

}

Also, for each WebService method in it, you need to decorate it with
<WebMethodAttribute>

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Date: Mon, 14 Jan 2008 17:01:06 -0500
From: cj <cj@nospam.nospam>
Subject: Re: publishing Hello World to local IIS

If I create a second class inside Service1.asmx it doesn't show in
http://localhost/Service1.asmx. I take it that is normal. I guess I'm
only allowed 1 class inside service1.asmx that will show and that class
must be named service1.asmx. Is this correct?

For instance in the below code http://localhost/Service1.asmx doesn't
show any of the Goodbye services. It does show HelloWorld and HelloCJ.

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET
AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()_
<System.Web.Services.WebService(Namespace:="http ://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
_1)>
_
<ToolboxItem(False)_
Public Class Service1
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function HelloWorld() As String
Return "Hello World"
End Function

<WebMethod()_
Public Function HelloCJ() As String
Return "Hello CJ"
End Function
End Class

<System.Web.Services.WebService(Namespace:="http ://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
_1)>
_
<ToolboxItem(False)_
Public Class Service2
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function GoodbyeWorld() As String
Return "Goodbye World"
End Function

<WebMethod()_
Public Function GoodbyeCJ() As String
Return "Goodbye CJ"
End Function
End Class

But even if I create a new service Service2.asmx inside the project and
put the goodbye code in it I can't get http://localhost/Service2.asmx
to bring up anything. I would have thought that would work.

Steven Cheng[MSFT] wrote:
>Hi Cj,

Glad that you've got progress. As for providing multiple webservices, I
think it is up to you that how to arrange those webservice
methods/endpoints.

If you have many service functions that belong to the same business
logic,
>you may group them in the same asmx service endpoint. Otherwise, you can
separate them into multiple webservice asmx endpoint. And you can create
separate webservice proxy classes for them.

In addition, if you want to make your client consumers easy to visit and
consume your service, I suggest you create a dedicated aspx web page
which
>grou p all the service's description page (...asmx?wsdl) on it (as
hyperlink). Thus, your clients can just visit that page and lookup all
the
>services you provided.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
--------------------
Date: Thu, 10 Jan 2008 11:14:15 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: Re: publishing Hello World to local IIS

>I got time this AM to look at this some more. My project is named
MyTestWebService1 and saved it to the default web site on the local IIS.
The WebMethod is HelloWorld. I was kind of surprised I had to type
http://localhost/Service1.asmx into the browser. It did then show me
that HelloWorld was there and I could test it.

I guess my question is if I want to make a couple of web services should
I add another .asmx file to the project? Or should I add another
WebMethod to Service1.asmx? Or should I start a new project for the
second web service?

How is this generally done? I want to do it as simply as possible but
also would like to do it the way most people are used to using them.

Eventually we have a couple business partners that will need to use the
web services and I want it to be easy for them to use.

Thanks for your help.
Steven Cheng[MSFT] wrote:
Jan 15 '08 #10

P: n/a
Hi Cj,

The "WebMethodAttribute" I mentioned is used to indicate that a certain
class method of the webservice class should be exposed as "webmethod"(which
can be called by client proxy as webservice method). Here is a typical
HelloWorld webservice:

================
<WebService(Namespace:="http://tempuri.org/")_
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)_
<Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()_
Public Class simpleservice
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function HelloWorld() As String
Return "Hello World"
End Function

End Class
=================

in VB.NET the syntax for applying attribute is <WebMethod()_

Therefore, to summarize, "<WebService>" is used at class level while
<WebMethodis used at function level, they're both used to decorate a
webservice class.

Does this clarify a bit?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Date: Tue, 15 Jan 2008 11:33:44 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: Re: publishing Hello World to local IIS
I'm sorry but what do you mean by:

Also, for each WebService method in it, you need to decorate it with
<WebMethodAttribute>

Can you give me an example of where I would add that? Am I right in
that it is needed for remote access to the web service?

<System.Web.Services.WebService(Name:="CJ's Service",
Description:="Testing 123")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
_1)>
_
<ToolboxItem(False)_
Public Class Service1

Steven Cheng[MSFT] wrote:
Hi Cj,

Yes, you should keep one webservice class in each asmx. Also, you can
add
more than one classes in an asmx file(codebehind), however, the key point
is that only one of them should be marked as a "WebService", this is done
through the "WebServiceAttrribute"(the <WebService(....)in VB.NET). e.g.

<WebService("Name=.....")>
public class ServiceClass
{

}

Also, for each WebService method in it, you need to decorate it with
<WebMethodAttribute>

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
--------------------
Date: Mon, 14 Jan 2008 17:01:06 -0500
From: cj <cj@nospam.nospam>
Subject: Re: publishing Hello World to local IIS

If I create a second class inside Service1.asmx it doesn't show in
http://localhost/Service1.asmx. I take it that is normal. I guess I'm
only allowed 1 class inside service1.asmx that will show and that class
must be named service1.asmx. Is this correct?

For instance in the below code http://localhost/Service1.asmx doesn't
show any of the Goodbye services. It does show HelloWorld and HelloCJ.

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET
AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()_
<System.Web.Services.WebService(Namespace:="http ://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
_1)>
_
<ToolboxItem(False)_
Public Class Service1
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function HelloWorld() As String
Return "Hello World"
End Function

<WebMethod()_
Public Function HelloCJ() As String
Return "Hello CJ"
End Function
End Class

<System.Web.Services.WebService(Namespace:="http ://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
_1)>
_
<ToolboxItem(False)_
Public Class Service2
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function GoodbyeWorld() As String
Return "Goodbye World"
End Function

<WebMethod()_
Public Function GoodbyeCJ() As String
Return "Goodbye CJ"
End Function
End Class

But even if I create a new service Service2.asmx inside the project and
put the goodbye code in it I can't get http://localhost/Service2.asmx
to bring up anything. I would have thought that would work.

Steven Cheng[MSFT] wrote:
>Hi Cj,

Glad that you've got progress. As for providing multiple webservices, I
think it is up to you that how to arrange those webservice
methods/endpoints.

If you have many service functions that belong to the same business
logic,
>you may group them in the same asmx service endpoint. Otherwise, you can
separate them into multiple webservice asmx endpoint. And you can create
separate webservice proxy classes for them.

In addition, if you want to make your client consumers easy to visit and
consume your service, I suggest you create a dedicated aspx web page
which
>grou p all the service's description page (...asmx?wsdl) on it (as
hyperlink). Thus, your clients can just visit that page and lookup all
the
>services you provided.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
--------------------
Date: Thu, 10 Jan 2008 11:14:15 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: Re: publishing Hello World to local IIS

>I got time this AM to look at this some more. My project is named
MyTestWebService1 and saved it to the default web site on the local IIS.
The WebMethod is HelloWorld. I was kind of surprised I had to type
http://localhost/Service1.asmx into the browser. It did then show me
that HelloWorld was there and I could test it.

I guess my question is if I want to make a couple of web services should
I add another .asmx file to the project? Or should I add another
WebMethod to Service1.asmx? Or should I start a new project for the
second web service?

How is this generally done? I want to do it as simply as possible but
also would like to do it the way most people are used to using them.

Eventually we have a couple business partners that will need to use the
web services and I want it to be easy for them to use.

Thanks for your help.
Steven Cheng[MSFT] wrote:
Jan 16 '08 #11

P: n/a
cj
I understand now. "Decorate" means to beautify to me and I was at a
loss as to how that worked with web services. I was thinking it
formatted the page pulled up by http://localhost/service1.asmx, like
changing the colors etc.

Steven Cheng[MSFT] wrote:
Hi Cj,

The "WebMethodAttribute" I mentioned is used to indicate that a certain
class method of the webservice class should be exposed as "webmethod"(which
can be called by client proxy as webservice method). Here is a typical
HelloWorld webservice:

================
<WebService(Namespace:="http://tempuri.org/")_
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)_
<Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()_
Public Class simpleservice
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function HelloWorld() As String
Return "Hello World"
End Function

End Class
=================

in VB.NET the syntax for applying attribute is <WebMethod()_

Therefore, to summarize, "<WebService>" is used at class level while
<WebMethodis used at function level, they're both used to decorate a
webservice class.

Does this clarify a bit?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Date: Tue, 15 Jan 2008 11:33:44 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: Re: publishing Hello World to local IIS
I'm sorry but what do you mean by:

Also, for each WebService method in it, you need to decorate it with
<WebMethodAttribute>

Can you give me an example of where I would add that? Am I right in
that it is needed for remote access to the web service?

<System.Web.Services.WebService(Name:="CJ's Service",
Description:="Testing 123")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
_1)>
_
<ToolboxItem(False)_
Public Class Service1

Steven Cheng[MSFT] wrote:
>Hi Cj,

Yes, you should keep one webservice class in each asmx. Also, you can
add
>more than one classes in an asmx file(codebehind), however, the key point
is that only one of them should be marked as a "WebService", this is done
through the "WebServiceAttrribute"(the <WebService(....)in VB.NET). e.g.

<WebService("Name=.....")>
public class ServiceClass
{

}

Also, for each WebService method in it, you need to decorate it with
<WebMethodAttribute>

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
>--------------------
Date: Mon, 14 Jan 2008 17:01:06 -0500
From: cj <cj@nospam.nospam>
Subject: Re: publishing Hello World to local IIS

If I create a second class inside Service1.asmx it doesn't show in
http://localhost/Service1.asmx. I take it that is normal. I guess I'm
only allowed 1 class inside service1.asmx that will show and that class
must be named service1.asmx. Is this correct?

For instance in the below code http://localhost/Service1.asmx doesn't
show any of the Goodbye services. It does show HelloWorld and HelloCJ.

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET
AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()_
<System.Web.Services.WebService(Namespace:="htt p://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
>_1)>
_
<ToolboxItem(False)_
Public Class Service1
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function HelloWorld() As String
Return "Hello World"
End Function

<WebMethod()_
Public Function HelloCJ() As String
Return "Hello CJ"
End Function
End Class

<System.Web.Services.WebService(Namespace:="htt p://tempuri.org/")_
<System.Web.Services.WebServiceBinding(ConformsTo: =WsiProfiles.BasicProfile1
>_1)>
_
<ToolboxItem(False)_
Public Class Service2
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function GoodbyeWorld() As String
Return "Goodbye World"
End Function

<WebMethod()_
Public Function GoodbyeCJ() As String
Return "Goodbye CJ"
End Function
End Class

But even if I create a new service Service2.asmx inside the project and
put the goodbye code in it I can't get http://localhost/Service2.asmx
to bring up anything. I would have thought that would work.

Steven Cheng[MSFT] wrote:
>>Hi Cj,

Glad that you've got progress. As for providing multiple webservices, I
think it is up to you that how to arrange those webservice
methods/endpoints.

If you have many service functions that belong to the same business
logic,
>>you may group them in the same asmx service endpoint. Otherwise, you can
separate them into multiple webservice asmx endpoint. And you can create
separate webservice proxy classes for them.

In addition, if you want to make your client consumers easy to visit and
consume your service, I suggest you create a dedicated aspx web page
which
>>grou p all the service's description page (...asmx?wsdl) on it (as
hyperlink). Thus, your clients can just visit that page and lookup all
the
>>services you provided.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
>>--------------------
Date: Thu, 10 Jan 2008 11:14:15 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: Re: publishing Hello World to local IIS
I got time this AM to look at this some more. My project is named
MyTestWebService1 and saved it to the default web site on the local IIS.
The WebMethod is HelloWorld. I was kind of surprised I had to type
http://localhost/Service1.asmx into the browser. It did then show me
that HelloWorld was there and I could test it.

I guess my question is if I want to make a couple of web services should
I add another .asmx file to the project? Or should I add another
WebMethod to Service1.asmx? Or should I start a new project for the
second web service?

How is this generally done? I want to do it as simply as possible but
also would like to do it the way most people are used to using them.

Eventually we have a couple business partners that will need to use the
web services and I want it to be easy for them to use.

Thanks for your help.
Steven Cheng[MSFT] wrote:
Jan 16 '08 #12

This discussion thread is closed

Replies have been disabled for this discussion.