hoony's web study

728x90
반응형

vs2008을 이용해서 웹서비스를 생성하니 아래와 같은 소스가 생성이 되네요
역시나 프레임웍3.5라서 그런지 Linq가 눈에 띄네요
저두 VS2008을 현재 스터디 하는 중이라 그때 그때마다 정리해 나갈려고 합니다.
혹시라도 실수나 설명에 의문점이 생기시면 댓글 달아주시구요 ㅎㅎ

using System;
using System.Data;
using System.Linq;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml.Linq;

namespace HoonWebservice
{
    /// <summary>
    /// Service1의 요약 설명입니다.
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // ASP.NET AJAX를 사용하여 스크립트에서 이 웹 서비스를 호출하려면 다음 줄의 주석 처리를 제거합니다.
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }
}
제가 지금 VS2008 베타 2를 이용하고 있습니다.
웹서비스를 생성 시키면 기본적으로 나오는것입니다.
예전엔 무작정 만들어서 썼는데 이제부터는 좀 정리를 하면서 갈려구요 ^^
닷넷 프레임웍 3.5를 이용한거니 좀 달라진 내용이 있나해서요 ㅎ
여기서 잘 안 찾고 넘어가는 부분을 정리를 할려고 합니다.
웹서비스의 속성이나 웹서비스바인딩속성에 대해서 일단 정리를 할려구요
역시나 속성에 대한 내용은 MSDN 내용을 참고해서 올립니다.

MSDN에 있는 help파일에는
<%@ WebService Language="C#" class= "ServerVariables"%>

using System.Web.Services;

[ WebService(Description="Server Variables",
              Namespace="http://www.microsoft.com/",
              Name="MyName")]
public class ServerVariables: WebService {
    [ WebMethod(Description="Returns the time as stored on the Server",
    EnableSession=false)]
    public string Time() {
       return Context.Timestamp.TimeOfDay.ToString();
    }
}

이런 예제가있습니다.
Webservice의 속성에는 Description, Namespace, Name 으로 되어있습니다.
Description 은 Web service에 대한 설명이구요 Name 은 이름을 설정하는 것입니다.
NameSpace의 경우는 Web Service에 사용할 기본 XML 네임스페이스를 가져오거나 설정하는 것입니다.

[WebServiceBinding(ConformsTo = WsiPriles.BasicProfile1_1)]와 같은 WebServiceBinding의 속성을 찾아보니  ConformsTo : Gets or sets the Web Services Interoperability (WSI) specification to which the binding claims to conform.(바인딩이 준수해야할 Web Services의 상호운용성을 가져오거나 설정
EmitConformanceClaims : Gets or sets a value that indicates whether the binding emits conformance claims. 바인딩이 준수 요구 사항을 나타낼지 여부를 지정하는 값을 가져오거나 설정하는 속성
Location :Gets or sets the location where the binding is defined. 바인딩이 어디에 정의되어있는지의 위치를 정하거나 가져오는 것
Name : 바인딩의 이름을 지정하거나 가져오는것.
TypeId : 파생된 크래스를 실행할때 유일한 속성을 가져오는것.
NameSpace : 바인딩과 관련된 네임스페이스를 지정하거나 가져오는것.

WebMethod에 대한 정리는 다음에 하도록 하겠습니다.
이미지가 없구 해석도 제가 해서 좀 그렇지만 천리길도 한걸음이라는 마음으로 하겠습니다.ㅎㅎ

728x90

공유하기

facebook twitter kakaoTalk kakaostory naver band
loading