您的位置:首页 > 其它

.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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: