.NET WEB SERVICE 学习记录
2005-04-08 11:52
537 查看
建立WEB SERVICE的server端
用VS2003, “文件”-》“新建” -》“项目” -》“C#项目”-》“ASP.NET WEB 服务”
新建项目名称为MYWEBSERVICE1,代码如下,不要忘了引用“System.Data.OracleClient”
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.IO;
using System.Data.OracleClient;
namespace mywebservice
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://localhost/mywebservice/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://localhost/mywebservice/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://localhost/mywebservice/">
- <s:element name="GetPersons">
<s:complexType />
</s:element>
- <s:element name="GetPersonsResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetPersonsResult" type="tns:ArrayOfPerson" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="ArrayOfPerson">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Person" nillable="true" type="tns:Person" />
</s:sequence>
</s:complexType>
- <s:complexType name="Person">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Gender" type="s:string" />
</s:sequence>
</s:complexType>
- <s:element name="GetPersonTable">
<s:complexType />
</s:element>
- <s:element name="GetPersonTableResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetPersonTableResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
- <wsdl:message name="GetPersonsSoapIn">
<wsdl:part name="parameters" element="tns:GetPersons" />
</wsdl:message>
- <wsdl:message name="GetPersonsSoapOut">
<wsdl:part name="parameters" element="tns:GetPersonsResponse" />
</wsdl:message>
- <wsdl:message name="GetPersonTableSoapIn">
<wsdl:part name="parameters" element="tns:GetPersonTable" />
</wsdl:message>
- <wsdl:message name="GetPersonTableSoapOut">
<wsdl:part name="parameters" element="tns:GetPersonTableResponse" />
</wsdl:message>
- <wsdl:portType name="Service1Soap">
- <wsdl:operation name="GetPersons">
<wsdl:input message="tns:GetPersonsSoapIn" />
<wsdl:output message="tns:GetPersonsSoapOut" />
</wsdl:operation>
- <wsdl:operation name="GetPersonTable">
<wsdl:input message="tns:GetPersonTableSoapIn" />
<wsdl:output message="tns:GetPersonTableSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="GetPersons">
<soap:operation soapAction="http://localhost/mywebservice/GetPersons" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="GetPersonTable">
<soap:operation soapAction="http://localhost/mywebservice/GetPersonTable" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="Service1">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
- <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
<soap:address location="http://localhost/mywebservice/Service1.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
用VS2003, “文件”-》“新建” -》“项目” -》“C#项目”-》“ASP.NET WEB 服务”
新建项目名称为MYWEBSERVICE1,代码如下,不要忘了引用“System.Data.OracleClient”
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.IO;
using System.Data.OracleClient;
namespace mywebservice
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://localhost/mywebservice/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://localhost/mywebservice/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://localhost/mywebservice/">
- <s:element name="GetPersons">
<s:complexType />
</s:element>
- <s:element name="GetPersonsResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetPersonsResult" type="tns:ArrayOfPerson" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="ArrayOfPerson">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Person" nillable="true" type="tns:Person" />
</s:sequence>
</s:complexType>
- <s:complexType name="Person">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Gender" type="s:string" />
</s:sequence>
</s:complexType>
- <s:element name="GetPersonTable">
<s:complexType />
</s:element>
- <s:element name="GetPersonTableResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetPersonTableResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
- <wsdl:message name="GetPersonsSoapIn">
<wsdl:part name="parameters" element="tns:GetPersons" />
</wsdl:message>
- <wsdl:message name="GetPersonsSoapOut">
<wsdl:part name="parameters" element="tns:GetPersonsResponse" />
</wsdl:message>
- <wsdl:message name="GetPersonTableSoapIn">
<wsdl:part name="parameters" element="tns:GetPersonTable" />
</wsdl:message>
- <wsdl:message name="GetPersonTableSoapOut">
<wsdl:part name="parameters" element="tns:GetPersonTableResponse" />
</wsdl:message>
- <wsdl:portType name="Service1Soap">
- <wsdl:operation name="GetPersons">
<wsdl:input message="tns:GetPersonsSoapIn" />
<wsdl:output message="tns:GetPersonsSoapOut" />
</wsdl:operation>
- <wsdl:operation name="GetPersonTable">
<wsdl:input message="tns:GetPersonTableSoapIn" />
<wsdl:output message="tns:GetPersonTableSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="GetPersons">
<soap:operation soapAction="http://localhost/mywebservice/GetPersons" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="GetPersonTable">
<soap:operation soapAction="http://localhost/mywebservice/GetPersonTable" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="Service1">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
- <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
<soap:address location="http://localhost/mywebservice/Service1.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
相关文章推荐
- 20101109 学习记录: C#.net访问web URL并处理返回值 && 不加web引用调用webservice
- 2009-05-24技术学习:Java中使用Axis调用.Net WebService
- 20100707 学习记录:[System.Web.Script.Services.ScriptService]引用问题
- 20100811 学习记录2:Webservice error, "The test form is only available for requests from the local machine"
- AJAX.NET WebService应用的学习体会
- .NET WEB SERVICES 学习记录(三)
- 系统地学习ASP.NET AJAX(9) - 客户端脚本编程(Sys.Net命名空间下的WebServiceProxy、WebServiceError、Generated Proxy Classes以及调用WebService、PageMethod)
- 【原创】 ASP.NET + C# + WEBSERVICE 返回表数据和记录数据
- ASP.NET Forum 学习笔记系列--Web.config
- Asp.net中的AJAX学习记录之二 体会AJAX页面刷新的不同(初体验)
- spring+webservice记录
- 步步为营 SharePoint 开发学习笔记系列 十、SharePoint web service 开发(下)
- 用XML+XSLT+CSS+JQuery+WebService组建Asp.Net网站
- @netserviceHandle及@符号的学习
- 先学习学习: Fine-Tune Your Web Site for Windows XP Service Pack 2
- Java Web中的Action、Dao、Service、Model学习笔记
- Java/.Net Web Service互操作要点
- 【webpack】学习记录 (二)
- SVG + Javascript + ASP.NET + WebService开发楼宇管理系统(四)
- Python模块学习 ---- fileinput - 成长的点滴,记录与分享 - 博客频道 - CSDN.NET