사고 중에 인터넷에서 웹 기반 금융 시스템을 보았습니다. ActiveX를 통해 구현됩니다. 실제로 WebService를 사용하여 DHTML을 결합하면 ActiveX를 완전히 제쳐두고 완전히 넣을 수 있습니다. 다음은 간단한 예입니다.
우선, 매우 간단한 웹 서비스는 자세히 설명하지 않고 의견을보십시오.
파일 연구 .asmx.cs
시스템 사용;
시스템 사용;
System.componentModel 사용;
System.Data 사용;
System.diagnostics 사용;
System.Web 사용;
System.Web.Services 사용;
System.xml.serialization 사용;
네임 스페이스 plityxml
{
/// <요약>
/// <br> 웹 서비스의 예 </br>
/// <br> 저자 : [이메일 보호] </br>
/// <br> 날짜 : 2001/12/21 </br>
/// <br> 역사 : 2001 년에 완료 // 12/21 </br>
/// </summary>
/// <비고>
///이 웹 사이트에서 구현 된 기능은 매우 간단합니다.
/// 두 가지 주요 함수가 있습니다. 하나는 사전 정의 된 항목 배열을 얻는 것입니다.
/// 또 다른 것은 레코드 유형 레코드를 저장하는 것입니다
/// </비고>
공개 수업 연구 : System.Web.Services.Webservice
{
개인 Arraylist M_arrites;
개인 Arraylist m_arrreocrds;
공개 연구 ()
{
// CodeGen :이 호출은 ASP.NET 웹 서비스 디자이너가 필요합니다.
InitializeComponent ();
this.m_arrreocrds = new ArrayList ();
this.m_arrites = new ArrayList ();
// 실험 데이터를 추가합니다
for (int i = 0; i <100; i ++)
{
this.m_arrites.add (새 항목 (itemname + i.toString ()
, itemValue + (i + 1) .toString ()));
}
}
/// <요약>
///
/// </summary>
/// <param name = a_stritemname> 항목 이름 </param>
/// <returns> 항목 객체 </returns>
개인 항목 getItem (String a_stritemname)
{
// trash (new Exception (server.urldecode (a_stritemname)));
for (int i = 0; i <this.m_arrites.count; i ++)
{
항목 항목 = (항목) this.m_arrites [i];
if (item.name == server.urldecode (a_stritemname) .trim ())
{
반품 항목;
}
}
널 리턴;
}
#영역 구성 요소 디자이너가 코드를 생성했습니다
// 웹 서비스 디자이너가 요구합니다
개인 iContainer 구성 요소 = NULL;
/// <요약>
/// 디자이너 지원에 필요한 방법 - 수정하지 마십시오.
/// 코드 편집기와 함께이 메소드의 내용.
/// </summary>
private void initializecomponent ()
{
}
/// <요약>
/// 사용중인 자원을 정리합니다.
/// </summary>
보호 된 재정의 무효 처분 (BOOL DERPOSING)
{
if (처분 && 구성 요소! = null)
{
components.dispose ();
}
base.dispose (dispose);
}
#endregion
[WebMethod]
public void additem (String a_strname, String a_strvalue)
{
this.m_arrites.add (새 항목 (a_strname, a_strvalue));
}
/// <요약>
/// 항목 목록을 가져옵니다
/// </summary>
/// <returns> arraylist </returns>
[WebMethod]
[xmlinclude (typeof (항목))]
public arraylist getitems ()
{
this.m_arrites를 반환하십시오.
}
/// <요약>
/// 레코드를 저장하십시오
/// </summary>
/// <param name = a_stritemname> </param>
/// <param name = a_strdemoname> </param>
/// <param name = a_intdemoamount> </param>
/// <returns> 성공하면 false를 반환하십시오. 그렇지 않으면 </returns>
[WebMethod]
Public Bool Saverecord (String a_stritemname
, String a_strdemoname, int a_intdemoamount)
{
노력하다
{
항목 항목 = this.getItem (a_stritemname);
if (item! = null)
{
this.m_arrreocrds.add (새 레코드 (this.m_arrreocrds.count + 1
, 항목
, 새로운 데모 (a_strdemoname, a_intdemoamount)));
}
또 다른
{
던지기 (새로운 예외 (항목 지정의 이름 오류!));
}
진실을 반환하십시오.
}
캐치 (예외 E)
{
던지기 (새로운 예외 (e.toString ()));
// 거짓을 반환합니다.
}
} // 엔드 메소드
} // 종료 클래스
/// <요약>
/// select와 같은 옵션에 해당하는 간단한 클래스
/// </summary>
공개 수업 항목
{
개인 문자열 m_strname;
개인 문자열 m_strvalue;
공개 문자열 이름
{
얻다
{
이 this.m_strname;
}
세트
{
this.m_strname = value;
}
}
공개 문자열 값
{
얻다
{
this.m_strvalue;
}
세트
{
this.m_strvalue = value;
}
}
공개 항목 (String a_strname, String a_strvalue)
{
this.m_strname = a_strname;
this.m_strvalue = a_strvalue;
}
공개 항목 ()
{
this.m_strname =;
this.m_strvalue =;
}
} // 종료 클래스
/// <요약>
/// 간단한 예제 클래스
/// 구조는 매우 간단하며 세 가지 멤버 변수입니다
/// 여러 유형의 int,
/// 항목 유형, 데모 유형
/// </summary>
공개 수업 기록
{
개인 int m_intid;
개인 품목 m_objmyitem;
개인 데모 m_objmydemo;
공개 레코드 ()
{
this.m_intid = 0;
this.m_objmydemo = new demo ();
this.m_objmyitem = 새 항목 ();
}
공개 레코드 (int a_intid, 항목 a_objitem, 데모 a_objdemo)
{
this.m_intid = a_intid;
this.m_objmydemo = a_objdemo;
this.m_objmyitem = a_objitem;
}
} // End Cals
/// <요약>
/// 간단한 예제 클래스
/// 구조는 매우 간단하며 두 개의 멤버 변수, 1 개의 이름과 하나의 금액 만있는 매우 간단합니다.
/// </summary>
공개 클래스 데모
{
개인 문자열 m_strname;
개인 int m_intamount;
공개 문자열 이름
{
얻다
{
이 this.m_strname;
}
세트
{
this.m_strname = value;
}
}
공개 int 금액
{
얻다
{
이 this.m_intamount;
}
세트
{
this.m_intamount = value;
}
}
/// <요약>
/// 생성자
/// </summary>
공개 데모 ()
{
this.m_intamount = 0;
this.m_strname =;
}
/// <요약>
/// 과부하 생성자
/// </summary>
/// <param name = a_strname> </param>
/// <param name = a_intamount> </param>
공개 데모 (String a_strname, int a_intamount)
{
this.m_intamount = a_intamount;
this.m_strname = a_strname;
}
} // 종료 클래스
} // 엔드 네임 스페이스