The Artima Developer Community
Sponsored Link

.NET Buzz Forum
ASMX's 'HelloWorld' as it is supposed to be - VS team look!

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Christian Weyer

Posts: 616
Nickname: cweyer
Registered: Sep, 2003

Christian Weyer is an independent Microsoft MSDN Regional Director and expert for Web services.
ASMX's 'HelloWorld' as it is supposed to be - VS team look! Posted: Jul 28, 2004 8:16 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Christian Weyer.
Original Post: ASMX's 'HelloWorld' as it is supposed to be - VS team look!
Feed Title: Christian Weyer: Web Services & .NET
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/cweyer/Rss.aspx
Feed Description: Philosophizing about and criticizing the brave new world ...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Christian Weyer
Latest Posts From Christian Weyer: Web Services & .NET

Advertisement

Sorry, I have a request. These days, I am thinking a lot about contract-first design and development of Web services. If we cannot get a nice graphical contract editor, then we at least could try to model our .NET-based code to hammer down an actual contract and decouple the internal .NET implementation from this message and interface contract notation. You may want to call this 'code-based contract-first' versus 'schema-based contract-first'. Anyway ...

Hopefully the Visual Studio 2005 team will change the default code template for the still too simple and misleading Web Services wizard in Beta 1. And ... what about the coding style with curly braces at the end of the line? The current Beta of VS 2005 generates ugly code, IMO.

So here is my suggestion of what Visual Studio should actually generate - in order to propagate the message-based nature of Web services (all other VS-necessary code and comments stuff ommitted ...):

HelloService.asmx.cs:

[WebService(Namespace="urn:thinktecture-com:demos:webservices:2004:v1")]
[SoapDocumentService(ParameterStyle=SoapParameterStyle.Bare)]
public class HelloService : System.Web.Services.WebService
{
   [WebMethod]
   [return: XmlElement(ElementName="HelloResponseMessage")]
   public HelloResp HelloWorld([XmlElement(ElementName="HelloRequestMessage")]HelloReq req)
   {
      HelloResp resp = new HelloResp();
      resp.Hello = "Hello again ...";

      return resp;
   }
}

Messages.cs:

[XmlType(TypeName="HelloRequest", Namespace="urn:thinktecture-com:demos:webservices:messages:v1")]
public class HelloReq
{
}

[XmlType(TypeName="HelloResponse", Namespace="urn:thinktecture-com:demos:webservices:messages:v1")]
public class HelloResp
{
   [XmlElement(ElementName="Hello")]
   public string Hello;
}

Hope this makes sense ... well, of course we could discuss whether it really has to be a classical 'Hello World' thingie at all ...

Read: ASMX's 'HelloWorld' as it is supposed to be - VS team look!

Topic: We are experiencing technical difficulties, please stand by... Previous Topic   Next Topic Topic: Managed Minidumps

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use