• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

如何在ASP环境下利用SOAP来调用C#开发的Web Services

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 17次 | 进入软件测试论坛讨论

领测软件测试网

如何在ASP环境下利用SOAP来调用C#开发的Web Services,作为.NET Web Services的斑竹,很多朋友都问我如何在其他环境下调用Web Services,原理其实很简单,大家都知道Web Services是基于SOAP协议通信的,在其他环境下自然可以利用SOAP来访问Web Services了。
下面我就一个具体的例子来说明调用过程。
开发环境:windows 2000
          SOAP Tookit3.0
          IIS
我用C#写了如下一个Web Services:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Web;
using System.Web.Services;

namespace WebService_1
{
 public class Service1 : System.Web.Services.WebService
 {
  string err_message;
  SqlDataAdapter my_adapter ;
  DataSet ds = new DataSet();
  DataSet ds1 = new DataSet();
  DataSet ds_err ;
  DataSet ds_value = new DataSet();
  DataTable myDataTable;
  public Service1()
  {
   InitializeComponent();
  }

  private System.Data.SqlClient.SqlConnection sqlConnection1;

  #region Component Designer generated code
  
  //Web 服务设计器所必需的
  private IContainer components = null;
    
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
   //
   // sqlConnection1
   //
   this.sqlConnection1.ConnectionString = "data source=QIEYJ;initial catalog=photos;persist security info=False;user id=sa;w" +
    "orkstation id=QIEYJ;packet size=4096";

  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if(disposing && components != null)
   {
    components.Dispose();
   }
   base.Dispose(disposing);  
  }
  

[1]    

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网