BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in WSCF/WCF

 
 
Page 15209 of 21350

ASMX HelloWorld As It Ought To Be

Blogger : Kirk Allen Evans Blog
All posts : All posts by Kirk Allen Evans Blog
Category : WSCF/WCF
Blogged date : 2006 Feb 05

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

IHelloService.cs:

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 = "HelloService", Namespace = "urn:thinktecture-com:demos:webservices:2004:v1")]
public interface IHelloService
{
    [WebMethod]
    [return: XmlElement(ElementName = "HelloResponseMessage")]
    [SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare)]
    HelloResp HelloWorld([XmlElement(ElementName = "HelloRequestMessage")]HelloReq req);
}

HelloService.cs:

using System;

public class HelloService : IHelloService
{
    #region IHelloService Members

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

        return resp;
    }

    #endregion
}

Messages.cs:

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

 

 

 


Read comments or post a reply to : ASMX HelloWorld As It Ought To Be
Page 15209 of 21350

Newest posts
 

    Email TopXML