Kirk Evans Blog

.NET From a Markup Perspective

ASMX HelloWorld As It Ought To Be

ASMX HelloWorld As It Ought To Be

  • Comments 3

You're right, Christian... HelloWorld should look a lot different.  Assuming it should be HelloWorld at all (Indigo templates so far name it MyOperation1), here is a little change to your proposed HelloWorld:


using System.Xml;
using System.Xml.Serialization;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, EmitConformanceClaims = true)]
[WebService(Name = "WebService", Namespace = "urn:thinktecture-com:demos:webservices:2004:v1")]
public interface IWebService
    [return: XmlElement(ElementName = "HelloResponseMessage")]
    [SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare)]
    HelloResp HelloWorld([XmlElement(ElementName = "HelloRequestMessage")]HelloReq req);


using System;

public class WebService : IWebService
    #region IWebService Members

    public HelloResp HelloWorld(HelloReq req)
        HelloResp resp = new HelloResp();
        resp.Hello = "Hello again ...";

        return resp;



using System;
using System.Xml.Serialization;

[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;


  • I did a presentation on ASMX 2.0 in the Atlanta office that showed off designing services using interfaces. ...
Page 1 of 1 (3 items)
Leave a Comment
  • Please add 1 and 5 and type the answer here:
  • Post
Translate This Page