简单的java webservice 接口 C#调用java webservice(crud)


废话不多说:直接代码。webservice的功能不限于此,只是个简单的例子!

代码片段(8)[全屏查看所有代码]

1. [代码]JNDI连接方式    

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package com.elvish.dao;
//导包
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.sql.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.List;
import javax.servlet.jsp.jstl.sql.Result;
import javax.servlet.jsp.jstl.sql.ResultSupport;
//公共dao类
public class CommonDao {
     //创建公共属性
     private Connection conn= null ;
     private PreparedStatement pst= null ;
     private ResultSet rs= null ;
     
     //定义公共连接的方法
     public Connection getConn(){
         try {
             
             //创建Context对象
             Context ct= new InitialContext();
             //获取数据源
             DataSource ds=(DataSource)ct.lookup( "java:comp/env/jdbc/exam" );
             //创建连接
             this .conn=ds.getConnection();
         } catch (Exception e) {
             // TODO: handle exception
             e.printStackTrace();
         }
         //返回连接结果
         return this .conn;
     }
     
     //定义所有数据库关闭的方法
     public void CloseAll(Connection conn,PreparedStatement pst,ResultSet rs){
         try {
             //判断连接对象是否为空并关闭
             if (conn!= null &&conn.isClosed()) {
                 conn.close();
                 conn= null ;
             }
             //判断执行对象是否为空并关闭
             if (pst!= null ) {
                 pst.close();
                 pst= null ;
             }
             //判断结果集对象是否为空并关闭
             if (rs!= null ) {
                 rs.close();
                 rs= null ;
             }
         } catch (Exception e) {
             // TODO: handle exception
             e.printStackTrace();
         }
     }
     
     //定义公共的增删改查方法(sql为sql语句,list为设置sql语句中的?值)
     public boolean excuteSQL(String sql,Object[] param){
         try {
             //创建连接
             this .conn= this .getConn();
             //创建pst对象,如果不为空并设置sql语句中的?值
             this .pst=conn.prepareStatement(sql);
             if (param!= null ) {
                 for ( int i = 0 ; i < param.length; i++) {
                     this .pst.setObject(i+ 1 , param[i]);
                 }
             }
 
             //执行并返回true,执行成功
             this .pst.executeUpdate();
             return true ;
         } catch (Exception e) {
             // TODO: handle exception
         } finally {
             //关闭连接
             this .CloseAll(conn, pst, rs);
         }
         //执行失败,返回false
         return false ;
     }
     
     //定义公共的查询方法,返回类型为Result
     public Result selectSQL(String sql,Object[] param){
         Result result= null ;
         try {
             //创建连接
             this .conn= this .getConn();
             //创建pst对象,如果数组不为空设置sql语句中?的值
             this .pst=conn.prepareStatement(sql);
             if (param!= null ) {
                 for ( int i = 0 ; i < param.length; i++) {
                     this .pst.setObject(i+ 1 , param[i]);
                 }
             }
             //查询
             this .rs= this .pst.executeQuery();
             //将结果赋给Result对象
             result=ResultSupport.toResult( this .rs);
         } catch (Exception e) {
             // TODO: handle exception
             e.printStackTrace();
         } finally {
             //关闭连接
             this .CloseAll(conn, pst, rs);
         }
         //返回结果
         return result;
     }
 
}

2. [代码]services.xml    

?
1
2
3
4
5
6
7
8
<? xml version = "1.0" encoding = "UTF-8" ?>
< beans xmlns = "http://xfire.codehaus.org/config/1.0" >
< service >
< name >examBook</ name >
< namespace >www.examBook.com</ namespace >
< serviceClass >com.elvish.dao.CommonDao</ serviceClass >
</ service >
</ beans >

3. [代码]web.xml    

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<? xml version = "1.0" encoding = "UTF-8" ?>
< web-app xmlns = "http://java.sun.com/xml/ns/j2ee" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
     version = "2.4"
     xsi:schemaLocation = "http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
     < servlet >
         < servlet-name >XFireServlet</ servlet-name >
         < servlet-class >org.codehaus.xfire.transport.http.XFireConfigurableServlet</ servlet-class >
         < load-on-startup >0</ load-on-startup >
     </ servlet >
     < servlet-mapping >
         < servlet-name >XFireServlet</ servlet-name >
         < url-pattern >/services/*</ url-pattern >
     </ servlet-mapping >
     < welcome-file-list >
         < welcome-file >index.jsp</ welcome-file >
     </ welcome-file-list >
 
     < resource-ref >
         < description >dateSource</ description >
         < res-ref-name >jdbc/exam</ res-ref-name >
         < res-type >javax.sql.DataSource</ res-type >
         < res-auth >Container</ res-auth >
     </ resource-ref >
 
 
</ web-app >

4. [代码]调用javawebservice接口    

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace examBook_webServices
{
     public partial class MainForm : Form
     {
         public MainForm()
         {
             InitializeComponent();
         }
 
         //查询按钮
         private void btnSelect_Click( object sender, EventArgs e)
         {
             //调用根据书名查询图书信息方法
             GetBookInfoByBookName();
         }
 
         private void GetBookInfoByBookName()
         {
             //清空listView
             lvBook.Items.Clear();
             //远程创建对象并调用方法
             localhost.examBook examBook = new examBook_webServices.localhost.examBook();
             string sql = "select * from book where bname like ?" ;
             Object[] param = new Object[] { "%" + txtSelect.Text + "%" };
             localhost.Result resultBook = examBook.selectSQL(sql, param);
             //如果查询的个数不为0
             if (resultBook.rowCount != 0)
             {
                 //遍历数据到listVew控件中
                 for ( int i = 0; i < resultBook.rowCount; i++)
                 {
                     ListViewItem lvt = new ListViewItem(resultBook.rows[i][2].value.ToString());
                     lvBook.Items.Add(lvt);
                     lvt.SubItems.AddRange( new String[] { resultBook.rows[i][1].value.ToString(), resultBook.rows[i][0].value.ToString(), resultBook.rows[i][3].value.ToString(), resultBook.rows[i][4].value.ToString() });
                 }
             }
             else
             {
                 MessageBox.Show( "没有数据!" );
             }
         }
 
         //清空按钮
         private void btnClean_Click( object sender, EventArgs e)
         {
             //清空文本框的值
             this .txtBookId.Text = "" ;
             this .txtBookName.Text = "" ;
             this .txtAuthor.Text = "" ;
             this .txtPrice.Text = "" ;
             this .txtRemarks.Text = "" ;
         }
 
         //新增按钮
         private void btnAdd_Click( object sender, EventArgs e)
         {
             //判断相关数据是否填写
             if ( this .txtBookName.Text== "" )
             {
                 MessageBox.Show( "请填写书名" );
             }
             else if ( this .txtAuthor.Text== "" )
             {
                 MessageBox.Show( "请填写作者" );
             }
             else if ( this .txtPrice.Text== "" )
             {
                 MessageBox.Show( "请填写价格" );
             }
             else if ( this .txtRemarks.Text== "" )
             {
                 MessageBox.Show( "请填写评论" );
             }
             else
             {
                 //远程创建对象并调用方法
                 localhost.examBook examBook = new examBook_webServices.localhost.examBook();
                 string sql = "insert into book(bname,authorname,price,remarks) values (?,?,?,?)" ;
                 Object[] param = new Object[] { this .txtBookName.Text, this .txtAuthor.Text, this .txtPrice.Text, this .txtRemarks.Text};
                 if (examBook.excuteSQL(sql,param))
                 {
                     MessageBox.Show( "添加成功!" );
                     //更新图书信息
                     GetBookInfoByBookName();
                 }
                 else
                 {
                     MessageBox.Show( "添加失败!" );
                 }
             }
         }
 
         //修改按钮
         private void btnSave_Click( object sender, EventArgs e)
         {
             //判断是否选中信息
             if ( this .txtBookId.Text== "" )
             {
                 MessageBox.Show( "请选中一条信息" );
                 return ;
             }
             else if ( this .txtBookName.Text == "" )
             {
                 MessageBox.Show( "请填写书名" );
             }
             else if ( this .txtAuthor.Text == "" )
             {
                 MessageBox.Show( "请填写作者" );
             }
             else if ( this .txtPrice.Text == "" )
             {
                 MessageBox.Show( "请填写价格" );
             }
             else if ( this .txtRemarks.Text == "" )
             {
                 MessageBox.Show( "请填写评论" );
             }
             else
             {
                 //远程创建对象并调用方法
                 localhost.examBook examBook = new examBook_webServices.localhost.examBook();
                 string sql = "update book set bname=?,authorname=?,price=?,remarks=? where id=?" ;
                 Object[] param = new Object[] { this .txtBookName.Text, this .txtAuthor.Text, this .txtPrice.Text, this .txtRemarks.Text, this .txtBookId.Text };
                 if (examBook.excuteSQL(sql, param))
                 {
                     MessageBox.Show( "修改成功!" );
                     //更新图书信息
                     GetBookInfoByBookName();
                 }
                 else
                 {
                     MessageBox.Show( "修改失败!" );
                 }
             }
         }
 
         //删除按钮
         private void btnDel_Click( object sender, EventArgs e)
         {
             //判断是否选中信息
             if ( this .txtBookId.Text == "" )
             {
                 MessageBox.Show( "请选中一条信息" );
                 return ;
             }
             else if ( this .txtBookName.Text == "" )
             {
                 MessageBox.Show( "请填写书名" );
             }
             else if ( this .txtAuthor.Text == "" )
             {
                 MessageBox.Show( "请填写作者" );
             }
             else if ( this .txtPrice.Text == "" )
             {
                 MessageBox.Show( "请填写价格" );
             }
             else if ( this .txtRemarks.Text == "" )
             {
                 MessageBox.Show( "请填写评论" );
             }
             else
             {
                 //远程创建对象并调用方法
                 localhost.examBook examBook = new examBook_webServices.localhost.examBook();
                 string sql = "delete book where id=?" ;
                 Object[] param = new Object[] { this .txtBookId.Text };
                 if (examBook.excuteSQL(sql, param))
                 {
                     MessageBox.Show( "删除成功!" );
                     //更新图书信息
                     GetBookInfoByBookName();
                 }
                 else
                 {
                     MessageBox.Show( "删除失败!" );
                 }
             }
         }
 
         //当鼠标单击控件中选中的一行数据时,在下面文本框中显示信息
         private void lvBook_MouseClick( object sender, MouseEventArgs e)
         {
             this .txtBookId.Text = lvBook.SelectedItems[0].SubItems[0].Text;
             this .txtBookName.Text = lvBook.SelectedItems[0].SubItems[1].Text;
             this .txtAuthor.Text = lvBook.SelectedItems[0].SubItems[2].Text;
             this .txtPrice.Text = lvBook.SelectedItems[0].SubItems[3].Text;
             this .txtRemarks.Text = lvBook.SelectedItems[0].SubItems[4].Text;
         }
     }
}

5. [代码]app.config    

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<? xml version = "1.0" encoding = "utf-8" ?>
< configuration >
     < configSections >
         < sectionGroup name = "applicationSettings" type = "System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
             < section name = "examBook_webServices.Properties.Settings" type = "System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission = "false" />
         </ sectionGroup >
     </ configSections >
     < applicationSettings >
         < examBook_webServices.Properties.Settings >
             < setting name = "examBook_webServices_localhost_examBook" serializeAs = "String" >
                 < value >http://localhost:8080/exam_webServices/services/examBook</ value >
             </ setting >
         </ examBook_webServices.Properties.Settings >
     </ applicationSettings >
</ configuration >

6. [代码]http://localhost:8080/exam_webServices/services/examBook?wsd    

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
   <? xml version = "1.0" encoding = "UTF-8" ?>
- < wsdl:definitions targetNamespace = "www.examBook.com" xmlns:ns2 = "http://sql.jstl.jsp.servlet.javax" xmlns:ns1 = "http://sql.java" xmlns:soapenc12 = "http://www.w3.org/2003/05/soap-encoding" xmlns:tns = "www.examBook.com" xmlns:wsdl = "http://schemas.xmlsoap.org/wsdl/" xmlns:xsd = "http://www.w3.org/2001/XMLSchema" xmlns:soap11 = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdlsoap = "http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc11 = "http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12 = "http://www.w3.org/2003/05/soap-envelope" >
- < wsdl:types >
- < xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema" attributeFormDefault = "qualified" elementFormDefault = "qualified" targetNamespace = "http://www.w3.org/2001/XMLSchema" >
- < xsd:complexType name = "ArrayOfAnyType" >
- < xsd:sequence >
   < xsd:element maxOccurs = "unbounded" minOccurs = "0" name = "anyType" nillable = "true" type = "xsd:anyType" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "ArrayOfArrayOfAnyType" >
- < xsd:sequence >
   < xsd:element maxOccurs = "unbounded" minOccurs = "0" name = "ArrayOfAnyType" nillable = "true" type = "xsd:ArrayOfAnyType" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:schema >
- < xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema" attributeFormDefault = "qualified" elementFormDefault = "qualified" targetNamespace = "www.examBook.com" >
- < xsd:element name = "excuteSQL" >
- < xsd:complexType >
- < xsd:sequence >
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "sql" nillable = "true" type = "xsd:string" />
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "param" nillable = "true" type = "xsd:ArrayOfAnyType" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:element >
- < xsd:element name = "excuteSQLResponse" >
- < xsd:complexType >
- < xsd:sequence >
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "out" type = "xsd:boolean" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:element >
- < xsd:element name = "getConn" >
   < xsd:complexType />
   </ xsd:element >
- < xsd:complexType name = "anyType2anyTypeMap" >
- < xsd:sequence >
- < xsd:element maxOccurs = "unbounded" minOccurs = "0" name = "entry" >
- < xsd:complexType >
- < xsd:sequence >
   < xsd:element maxOccurs = "1" minOccurs = "0" name = "key" type = "xsd:anyType" />
   < xsd:element maxOccurs = "1" minOccurs = "0" name = "value" type = "xsd:anyType" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:element >
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "anyType2anyType2anyTypeMapMap" >
- < xsd:sequence >
- < xsd:element maxOccurs = "unbounded" minOccurs = "0" name = "entry" >
- < xsd:complexType >
- < xsd:sequence >
   < xsd:element maxOccurs = "1" minOccurs = "0" name = "key" type = "xsd:anyType" />
   < xsd:element maxOccurs = "1" minOccurs = "0" name = "value" type = "tns:anyType2anyTypeMap" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:element >
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:element name = "getConnResponse" >
- < xsd:complexType >
- < xsd:sequence >
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "out" nillable = "true" type = "ns1:Connection" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:element >
- < xsd:element name = "selectSQL" >
- < xsd:complexType >
- < xsd:sequence >
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "sql" nillable = "true" type = "xsd:string" />
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "param" nillable = "true" type = "xsd:ArrayOfAnyType" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:element >
- < xsd:complexType name = "ArrayOfString" >
- < xsd:sequence >
   < xsd:element maxOccurs = "unbounded" minOccurs = "0" name = "string" nillable = "true" type = "xsd:string" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "ArrayOfAnyType2anyTypeMap" >
- < xsd:sequence >
   < xsd:element maxOccurs = "unbounded" minOccurs = "0" name = "anyType2anyTypeMap" nillable = "true" type = "tns:anyType2anyTypeMap" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:element name = "selectSQLResponse" >
- < xsd:complexType >
- < xsd:sequence >
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "out" nillable = "true" type = "ns2:Result" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:element >
- < xsd:element name = "CloseAll" >
- < xsd:complexType >
- < xsd:sequence >
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "conn" nillable = "true" type = "ns1:Connection" />
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "pst" nillable = "true" type = "ns1:PreparedStatement" />
   < xsd:element maxOccurs = "1" minOccurs = "1" name = "rs" nillable = "true" type = "ns1:ResultSet" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:element >
- < xsd:element name = "CloseAllResponse" >
   < xsd:complexType />
   </ xsd:element >
   </ xsd:schema >
- < xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema" attributeFormDefault = "qualified" elementFormDefault = "qualified" targetNamespace = "http://sql.java" >
- < xsd:complexType name = "Connection" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "autoCommit" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "catalog" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "clientInfo" nillable = "true" type = "tns:anyType2anyType2anyTypeMapMap" />
   < xsd:element minOccurs = "0" name = "closed" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "holdability" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "metaData" nillable = "true" type = "ns1:DatabaseMetaData" />
   < xsd:element minOccurs = "0" name = "networkTimeout" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "readOnly" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "schema" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "transactionIsolation" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "typeMap" nillable = "true" type = "tns:anyType2anyTypeMap" />
   < xsd:element minOccurs = "0" name = "warnings" nillable = "true" type = "ns1:SQLWarning" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "DatabaseMetaData" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "JDBCMajorVersion" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "JDBCMinorVersion" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "SQLKeywords" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "SQLStateType" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "URL" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "catalogAtStart" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "catalogSeparator" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "catalogTerm" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "catalogs" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "clientInfoProperties" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "connection" nillable = "true" type = "ns1:Connection" />
   < xsd:element minOccurs = "0" name = "databaseMajorVersion" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "databaseMinorVersion" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "databaseProductName" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "databaseProductVersion" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "defaultTransactionIsolation" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "driverMajorVersion" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "driverMinorVersion" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "driverName" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "driverVersion" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "extraNameCharacters" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "identifierQuoteString" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "maxBinaryLiteralLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxCatalogNameLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxCharLiteralLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxColumnNameLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxColumnsInGroupBy" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxColumnsInIndex" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxColumnsInOrderBy" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxColumnsInSelect" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxColumnsInTable" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxConnections" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxCursorNameLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxIndexLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxProcedureNameLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxRowSize" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxSchemaNameLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxStatementLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxStatements" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxTableNameLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxTablesInSelect" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxUserNameLength" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "numericFunctions" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "procedureTerm" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "readOnly" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "resultSetHoldability" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "rowIdLifetime" nillable = "true" type = "ns1:RowIdLifetime" />
   < xsd:element minOccurs = "0" name = "schemaTerm" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "schemas" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "searchStringEscape" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "stringFunctions" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "systemFunctions" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "tableTypes" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "timeDateFunctions" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "typeInfo" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "userName" nillable = "true" type = "xsd:string" />
   </ xsd:sequence >
   </ xsd:complexType >
+ < xsd:simpleType name = "RowIdLifetime" >
- < xsd:restriction base = "xsd:string" >
   < xsd:enumeration value = "ROWID_UNSUPPORTED" />
   < xsd:enumeration value = "ROWID_VALID_OTHER" />
   < xsd:enumeration value = "ROWID_VALID_SESSION" />
   < xsd:enumeration value = "ROWID_VALID_TRANSACTION" />
   < xsd:enumeration value = "ROWID_VALID_FOREVER" />
   </ xsd:restriction >
   </ xsd:simpleType >
- < xsd:complexType name = "ResultSet" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "afterLast" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "beforeFirst" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "closed" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "concurrency" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "cursorName" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "fetchDirection" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "fetchSize" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "first" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "holdability" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "last" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "metaData" nillable = "true" type = "ns1:ResultSetMetaData" />
   < xsd:element minOccurs = "0" name = "row" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "statement" nillable = "true" type = "ns1:Statement" />
   < xsd:element minOccurs = "0" name = "type" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "warnings" nillable = "true" type = "ns1:SQLWarning" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "ResultSetMetaData" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "columnCount" type = "xsd:int" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "SQLWarning" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "SQLState" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "errorCode" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "nextException" nillable = "true" type = "ns1:SQLException" />
   < xsd:element minOccurs = "0" name = "nextWarning" nillable = "true" type = "ns1:SQLWarning" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "SQLException" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "SQLState" nillable = "true" type = "xsd:string" />
   < xsd:element minOccurs = "0" name = "errorCode" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "nextException" nillable = "true" type = "ns1:SQLException" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "Statement" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "closeOnCompletion" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "closed" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "connection" nillable = "true" type = "ns1:Connection" />
   < xsd:element minOccurs = "0" name = "fetchDirection" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "fetchSize" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "generatedKeys" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "maxFieldSize" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxRows" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "poolable" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "queryTimeout" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "resultSet" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "resultSetConcurrency" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "resultSetHoldability" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "resultSetType" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "updateCount" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "warnings" nillable = "true" type = "ns1:SQLWarning" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "PreparedStatement" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "metaData" nillable = "true" type = "ns1:ResultSetMetaData" />
   < xsd:element minOccurs = "0" name = "parameterMetaData" nillable = "true" type = "ns1:ParameterMetaData" />
   < xsd:element minOccurs = "0" name = "closeOnCompletion" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "closed" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "connection" nillable = "true" type = "ns1:Connection" />
   < xsd:element minOccurs = "0" name = "fetchDirection" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "fetchSize" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "generatedKeys" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "maxFieldSize" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "maxRows" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "poolable" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "queryTimeout" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "resultSet" nillable = "true" type = "ns1:ResultSet" />
   < xsd:element minOccurs = "0" name = "resultSetConcurrency" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "resultSetHoldability" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "resultSetType" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "updateCount" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "warnings" nillable = "true" type = "ns1:SQLWarning" />
   </ xsd:sequence >
   </ xsd:complexType >
- < xsd:complexType name = "ParameterMetaData" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "parameterCount" type = "xsd:int" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:schema >
- < xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema" attributeFormDefault = "qualified" elementFormDefault = "qualified" targetNamespace = "http://sql.jstl.jsp.servlet.javax" >
- < xsd:complexType name = "Result" >
- < xsd:sequence >
   < xsd:element minOccurs = "0" name = "columnNames" nillable = "true" type = "tns:ArrayOfString" />
   < xsd:element minOccurs = "0" name = "limitedByMaxRows" type = "xsd:boolean" />
   < xsd:element minOccurs = "0" name = "rowCount" type = "xsd:int" />
   < xsd:element minOccurs = "0" name = "rows" nillable = "true" type = "tns:ArrayOfAnyType2anyTypeMap" />
   < xsd:element minOccurs = "0" name = "rowsByIndex" nillable = "true" type = "xsd:ArrayOfArrayOfAnyType" />
   </ xsd:sequence >
   </ xsd:complexType >
   </ xsd:schema >
   </ wsdl:types >
- < wsdl:message name = "CloseAllResponse" >
   < wsdl:part name = "parameters" element = "tns:CloseAllResponse" />
   </ wsdl:message >
- < wsdl:message name = "excuteSQLResponse" >
   < wsdl:part name = "parameters" element = "tns:excuteSQLResponse" />
   </ wsdl:message >
- < wsdl:message name = "CloseAllRequest" >
   < wsdl:part name = "parameters" element = "tns:CloseAll" />
   </ wsdl:message >
- < wsdl:message name = "selectSQLRequest" >
   < wsdl:part name = "parameters" element = "tns:selectSQL" />
   </ wsdl:message >
- < wsdl:message name = "excuteSQLRequest" >
   < wsdl:part name = "parameters" element = "tns:excuteSQL" />
   </ wsdl:message >
- < wsdl:message name = "selectSQLResponse" >
   < wsdl:part name = "parameters" element = "tns:selectSQLResponse" />
   </ wsdl:message >
- < wsdl:message name = "getConnRequest" >
   < wsdl:part name = "parameters" element = "tns:getConn" />
   </ wsdl:message >
- < wsdl:message name = "getConnResponse" >
   < wsdl:part name = "parameters" element = "tns:getConnResponse" />
   </ wsdl:message >
- < wsdl:portType name = "examBookPortType" >
- < wsdl:operation name = "excuteSQL" >
   < wsdl:input name = "excuteSQLRequest" message = "tns:excuteSQLRequest" />
   < wsdl:output name = "excuteSQLResponse" message = "tns:excuteSQLResponse" />
   </ wsdl:operation >
- < wsdl:operation name = "getConn" >
   < wsdl:input name = "getConnRequest" message = "tns:getConnRequest" />
   < wsdl:output name = "getConnResponse" message = "tns:getConnResponse" />
   </ wsdl:operation >
- < wsdl:operation name = "selectSQL" >
   < wsdl:input name = "selectSQLRequest" message = "tns:selectSQLRequest" />
   < wsdl:output name = "selectSQLResponse" message = "tns:selectSQLResponse" />
   </ wsdl:operation >
- < wsdl:operation name = "CloseAll" >
   < wsdl:input name = "CloseAllRequest" message = "tns:CloseAllRequest" />
   < wsdl:output name = "CloseAllResponse" message = "tns:CloseAllResponse" />
   </ wsdl:operation >
   </ wsdl:portType >
- < wsdl:binding name = "examBookHttpBinding" type = "tns:examBookPortType" >
   < wsdlsoap:binding style = "document" transport = "http://schemas.xmlsoap.org/soap/http" />
- < wsdl:operation name = "excuteSQL" >
   < wsdlsoap:operation soapAction = "" />
- < wsdl:input name = "excuteSQLRequest" >
   < wsdlsoap:body use = "literal" />
   </ wsdl:input >
- < wsdl:output name = "excuteSQLResponse" >
   < wsdlsoap:body use = "literal" />
   </ wsdl:output >
   </ wsdl:operation >
- < wsdl:operation name = "getConn" >
   < wsdlsoap:operation soapAction = "" />
- < wsdl:input name = "getConnRequest" >
   < wsdlsoap:body use = "literal" />
   </ wsdl:input >
- < wsdl:output name = "getConnResponse" >
   < wsdlsoap:body use = "literal" />
   </ wsdl:output >
   </ wsdl:operation >
- < wsdl:operation name = "selectSQL" >
   < wsdlsoap:operation soapAction = "" />
- < wsdl:input name = "selectSQLRequest" >
   < wsdlsoap:body use = "literal" />
   </ wsdl:input >
- < wsdl:output name = "selectSQLResponse" >
   < wsdlsoap:body use = "literal" />
   </ wsdl:output >
   </ wsdl:operation >
- < wsdl:operation name = "CloseAll" >
   < wsdlsoap:operation soapAction = "" />
- < wsdl:input name = "CloseAllRequest" >
   < wsdlsoap:body use = "literal" />
   </ wsdl:input >
- < wsdl:output name = "CloseAllResponse" >
   < wsdlsoap:body use = "literal" />
   </ wsdl:output >
   </ wsdl:operation >
   </ wsdl:binding >
- < wsdl:service name = "examBook" >
- < wsdl:port name = "examBookHttpPort" binding = "tns:examBookHttpBinding" >
   < wsdlsoap:address location = "http://localhost:8080/exam_webServices/services/examBook" />
   </ wsdl:port >
   </ wsdl:service >
   </ wsdl:definitions >

7. [图片] 1.JPG    

8. [文件] webService项目.rar ~ 601KB     下载(282)    



开源中国-程序员在线工具:Git代码托管 API文档大全(120+) JS在线编辑演示 二维码 更多»

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值