Re: publishing Hello World to local IIS



{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Thanks for your response Cj,
\par
\par The asmx present document page contains wsdl document which is expected to be read/parse by other webservice client proxy generator/parsers, therefore beautiful or colorful is not important for it :-)
\par
\par Here are some general reference about the webservice essentials( most of them are of XML webservice standard, not platform coupled concepts) which may help you better understand webservice:
\par
\par #Understanding Web Services
\par http://msdn2.microsoft.com/en-us/webservices/aa740685.aspx
\par
\par Sincerely,
\par
\par Steven Cheng
\par
\par Microsoft MSDN Online Support Lead
\par \tab
\par
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par
\par
\par \pard\li720 --------------------
\par Date: Wed, 16 Jan 2008 08:46:59 -0500
\par From: cj <cj@xxxxxxxxxxxxx>
\par User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
\par MIME-Version: 1.0
\par Subject: Re: publishing Hello World to local IIS
\par Lines: 1
\par Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
\par Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.webservices:2825
\par X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
\par
\par I understand now. "Decorate" means to beautify to me and I was at a
\par loss as to how that worked with web services. I was thinking it
\par formatted the page pulled up by http://localhost/service1.asmx, like
\par changing the colors etc.
\par
\par
\par
\par Steven Cheng[MSFT] wrote:
\par > Hi Cj,
\par >
\par > The "WebMethodAttribute" I mentioned is used to indicate that a certain
\par > class method of the webservice class should be exposed as "webmethod"(which
\par > can be called by client proxy as webservice method). Here is a typical
\par > HelloWorld webservice:
\par >
\par > ================
\par > <WebService(Namespace:="http://tempuri.org/";)> _
\par > <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
\par > <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
\par > Public Class simpleservice
\par > Inherits System.Web.Services.WebService
\par >
\par > <WebMethod()> _
\par > Public Function HelloWorld() As String
\par > Return "Hello World"
\par > End Function
\par >
\par > End Class
\par > =================
\par >
\par > in VB.NET the syntax for applying attribute is <WebMethod()> _
\par >
\par > Therefore, to summarize, "<WebService>" is used at class level while
\par > <WebMethod> is used at function level, they're both used to decorate a
\par > webservice class.
\par >
\par > Does this clarify a bit?
\par >
\par > Sincerely,
\par >
\par > Steven Cheng
\par >
\par > Microsoft MSDN Online Support Lead
\par > \tab
\par >
\par > This posting is provided "AS IS" with no warranties, and confers no rights.
\par >
\par >
\par >
\par > --------------------
\par > Date: Tue, 15 Jan 2008 11:33:44 -0500
\par > From: cj <cj@xxxxxxxxxxxxx>
\par > User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
\par > MIME-Version: 1.0
\par > Subject: Re: publishing Hello World to local IIS
\par >
\par >
\par > I'm sorry but what do you mean by:
\par >
\par > Also, for each WebService method in it, you need to decorate it with
\par > <WebMethodAttribute>
\par >
\par > Can you give me an example of where I would add that? Am I right in
\par > that it is needed for remote access to the web service?
\par >
\par > <System.Web.Services.WebService(Name:="CJ's Service",
\par > Description:="Testing 123")> _
\par > <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1
\par > _1)>
\par > _
\par > <ToolboxItem(False)> _
\par > Public Class Service1
\par >
\par > Steven Cheng[MSFT] wrote:
\par >> Hi Cj,
\par >>
\par >> Yes, you should keep one webservice class in each asmx. Also, you can
\par > add
\par >> more than one classes in an asmx file(codebehind), however, the key point
\par >> is that only one of them should be marked as a "WebService", this is done
\par >> through the "WebServiceAttrribute"(the <WebService(....)> in VB.NET). e.g.
\par >>
\par >> <WebService("Name=.....")>
\par >> public class ServiceClass
\par >> \{
\par >>
\par >> \}
\par >>
\par >> Also, for each WebService method in it, you need to decorate it with
\par >> <WebMethodAttribute>
\par >>
\par >> Sincerely,
\par >>
\par >> Steven Cheng
\par >>
\par >> Microsoft MSDN Online Support Lead
\par >>
\par >>
\par >> This posting is provided "AS IS" with no warranties, and confers no
\par > rights.
\par >> --------------------
\par >> Date: Mon, 14 Jan 2008 17:01:06 -0500
\par >> From: cj <cj@xxxxxxxxxxxxx>
\par >> Subject: Re: publishing Hello World to local IIS
\par >>
\par >> If I create a second class inside Service1.asmx it doesn't show in
\par >> http://localhost/Service1.asmx. I take it that is normal. I guess I'm
\par >> only allowed 1 class inside service1.asmx that will show and that class
\par >> must be named service1.asmx. Is this correct?
\par >>
\par >> For instance in the below code http://localhost/Service1.asmx doesn't
\par >> show any of the Goodbye services. It does show HelloWorld and HelloCJ.
\par >>
\par >> Imports System.Web.Services
\par >> Imports System.Web.Services.Protocols
\par >> Imports System.ComponentModel
\par >>
\par >> ' To allow this Web Service to be called from script, using ASP.NET
\par >> AJAX, uncomment the following line.
\par >> ' <System.Web.Script.Services.ScriptService()> _
\par >> <System.Web.Services.WebService(Namespace:="http://tempuri.org/";)> _
\par >>
\par > <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1
\par >> _1)>
\par >> _
\par >> <ToolboxItem(False)> _
\par >> Public Class Service1
\par >> Inherits System.Web.Services.WebService
\par >>
\par >> <WebMethod()> _
\par >> Public Function HelloWorld() As String
\par >> Return "Hello World"
\par >> End Function
\par >>
\par >> <WebMethod()> _
\par >> Public Function HelloCJ() As String
\par >> Return "Hello CJ"
\par >> End Function
\par >> End Class
\par >>
\par >> <System.Web.Services.WebService(Namespace:="http://tempuri.org/";)> _
\par >>
\par > <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1
\par >> _1)>
\par >> _
\par >> <ToolboxItem(False)> _
\par >> Public Class Service2
\par >> Inherits System.Web.Services.WebService
\par >>
\par >> <WebMethod()> _
\par >> Public Function GoodbyeWorld() As String
\par >> Return "Goodbye World"
\par >> End Function
\par >>
\par >> <WebMethod()> _
\par >> Public Function GoodbyeCJ() As String
\par >> Return "Goodbye CJ"
\par >> End Function
\par >> End Class
\par >>
\par >>
\par >>
\par >> But even if I create a new service Service2.asmx inside the project and
\par >> put the goodbye code in it I can't get http://localhost/Service2.asmx
\par >> to bring up anything. I would have thought that would work.
\par >>
\par >>
\par >>
\par >> Steven Cheng[MSFT] wrote:
\par >>> Hi Cj,
\par >>>
\par >>> Glad that you've got progress. As for providing multiple webservices, I
\par >>> think it is up to you that how to arrange those webservice
\par >>> methods/endpoints.
\par >>>
\par >>> If you have many service functions that belong to the same business
\par >> logic,
\par >>> you may group them in the same asmx service endpoint. Otherwise, you can
\par >>> separate them into multiple webservice asmx endpoint. And you can create
\par >>> separate webservice proxy classes for them.
\par >>>
\par >>> In addition, if you want to make your client consumers easy to visit and
\par >>> consume your service, I suggest you create a dedicated aspx web page
\par >> which
\par >>> grou p all the service's description page (...asmx?wsdl) on it (as
\par >>> hyperlink). Thus, your clients can just visit that page and lookup all
\par >> the
\par >>> services you provided.
\par >>>
\par >>> Sincerely,
\par >>>
\par >>> Steven Cheng
\par >>>
\par >>> Microsoft MSDN Online Support Lead
\par >>>
\par >>>
\par >>> This posting is provided "AS IS" with no warranties, and confers no
\par >> rights.
\par >>> --------------------
\par >>> Date: Thu, 10 Jan 2008 11:14:15 -0500
\par >>> From: cj <cj@xxxxxxxxxxxxx>
\par >>> User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
\par >>> MIME-Version: 1.0
\par >>> Subject: Re: publishing Hello World to local IIS
\par >>>
\par >>>
\par >>> I got time this AM to look at this some more. My project is named
\par >>> MyTestWebService1 and saved it to the default web site on the local IIS.
\par >>> The WebMethod is HelloWorld. I was kind of surprised I had to type
\par >>> http://localhost/Service1.asmx into the browser. It did then show me
\par >>> that HelloWorld was there and I could test it.
\par >>>
\par >>> I guess my question is if I want to make a couple of web services should
\par >>> I add another .asmx file to the project? Or should I add another
\par >>> WebMethod to Service1.asmx? Or should I start a new project for the
\par >>> second web service?
\par >>>
\par >>> How is this generally done? I want to do it as simply as possible but
\par >>> also would like to do it the way most people are used to using them.
\par >>>
\par >>> Eventually we have a couple business partners that will need to use the
\par >>> web services and I want it to be easy for them to use.
\par >>>
\par >>> Thanks for your help.
\par >>>
\par >>>
\par >>> Steven Cheng[MSFT] wrote:
\par >
\par \pard
\par
\par }

Relevant Pages

  • Re: publishing Hello World to local IIS
    ... "Decorate" means to beautify to me and I was at a loss as to how that worked with web services. ... The "WebMethodAttribute" I mentioned is used to indicate that a certain class method of the webservice class should be exposed as "webmethod". ... Public Function HelloWorld() As String ... Public Class Service1 ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: publishing Hello World to local IIS
    ... Public Class Service1 ... you should keep one webservice class in each asmx. ... Also, for each WebService method in it, you need to decorate it with <WebMethodAttribute> ... ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: WebService - XML
    ... how to send the soap-xml, but not how to get the webservice to work with it. ... Public Class Service1 ... Curt Christianson site: http://www.darkfalz.com blog: http://blog.darkfalz.com. ...
    (microsoft.public.dotnet.framework.aspnet)
  • WebService - XML
    ... How do I change my webservice, ... how to send the soap-xml, but not how to get the webservice to work ... Public Class Service1 ... Public Function Add ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: use SOAP header for asp.net session state
    ... We are creating web services for our customer to get data in and out of the system. ... HttpWebRequest class to send/receive webservice request/response SOAP ... cookie returned from server-side ASP.NET webservice. ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.webservices)