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@xxxxxxxxxxxxx>
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:
.



Relevant Pages

  • Re: Web Service Error - Server was unable to process request. --> Requested registry
    ... I don't believe that my web service is accessing the registry anywhere. ... ' The HelloWorldexample service returns the string Hello World. ... Public Function InsertNewManuAs Boolean ... #Region "Monitor Component Specs" ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Share Class Library between Service and Consumer
    ... So you can't use your originating class client side, ... > I want to share a class library between a web service and it's consumer ... > public function method1(param as string) as ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Urgent ! Cannot return XmlDocument Object in .NET 1.0
    ... I copied examples from the web and start writing a test Web Service as ... Public Function GetXmlDocumentAs XmlDocument ... node, String name, String ns, Boolean any) ... node, String name, String ns, Boolean isNullable, Boolean any) ...
    (microsoft.public.dotnet.framework.webservices)
  • Confused about the MessageName attribute
    ... I created a web service with two overloaded methods, ... Public Function GetItem(ByVal localItem As String) As String ... Public Function GetItemAs String ... class, my methods appear as GetItem and GetItem1, and that's my doubt. ...
    (microsoft.public.dotnet.general)
  • Re: WSE 3.0, usernameOverTransportSecurity, custom Token Manager w/ securityTokenManager,
    ... I've added the web service call directly to my Data binding method ... expected but not present in the security header of the incoming ... the username token to the message. ... protected override string AuthenticateToken(UsernameToken token) ...
    (microsoft.public.dotnet.framework.webservices.enhancements)

Loading