axis入門之配置篇
jacky于2006廣州
一 首先,你需要去官方下載相關的jar.
包含的jar有:









二 在Eclipse中建立一個Web工程:WebService
?把上面的jar放到WEB-INF/lib/文件夾中.
配置web.xml文件如下:
?1
<?
xml?version="1.0"?encoding="UTF-8"
?>
?2
<
web-app?
version
="2.4"
?
?3
????xmlns
="http://java.sun.com/xml/ns/j2ee"
?
?4
????xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
?
?5
????xsi:schemaLocation
="http://java.sun.com/xml/ns/j2ee?
?6
????http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>
?7
<
display-name
>
Apache-Axis
</
display-name
>
?8
?9
????
<
listener
>
10
????????
<
listener-class
>
org.apache.axis.transport.http.AxisHTTPSessionListener
</
listener-class
>
11
????
</
listener
>
12
13
????
<
servlet
>
14
????????
<
display-name
>
Apache-Axis?Servlet
</
display-name
>
15
????????
<
servlet-name
>
AxisServlet
</
servlet-name
>
16
????????
<
servlet-class
>
org.apache.axis.transport.http.AxisServlet
</
servlet-class
>
17
????
</
servlet
>
18
19
????
<
servlet
>
20
????
<
display-name
>
Axis?Admin?Servlet
</
display-name
>
21
????????
<
servlet-name
>
AdminServlet
</
servlet-name
>
22
????????
<
servlet-class
>
org.apache.axis.transport.http.AdminServlet
</
servlet-class
>
23
????????
<
load-on-startup
>
100
</
load-on-startup
>
24
????
</
servlet
>
25
26
????
<
servlet
>
27
????????
<
display-name
>
SOAPMonitorService
</
display-name
>
28
????????
<
servlet-name
>
SOAPMonitorService
</
servlet-name
>
29
????????
<
servlet-class
>
org.apache.axis.monitor.SOAPMonitorService
</
servlet-class
>
30
????????
<
init-param
>
31
????????????
<
param-name
>
SOAPMonitorPort
</
param-name
>
32
????????????
<
param-value
>
5001
</
param-value
>
33
????????
</
init-param
>
34
????????
<
load-on-startup
>
100
</
load-on-startup
>
35
????
</
servlet
>
36
<!--
?
37
????<servlet-mapping>
38
????????<servlet-name>AxisServlet</servlet-name>
39
????????<url-pattern>/servlet/AxisServlet</url-pattern>
40
????</servlet-mapping>
41
42
????<servlet-mapping>
43
????????<servlet-name>AxisServlet</servlet-name>
44
????????<url-pattern>*.jws</url-pattern>
45
????</servlet-mapping>
46
-->
47
????
<
servlet-mapping
>
48
????????
<
servlet-name
>
AxisServlet
</
servlet-name
>
49
????????
<
url-pattern
>
/services/*
</
url-pattern
>
50
????
</
servlet-mapping
>
51
52
????
<
servlet-mapping
>
53
????????
<
servlet-name
>
SOAPMonitorService
</
servlet-name
>
54
????????
<
url-pattern
>
/SOAPMonitor
</
url-pattern
>
55
????
</
servlet-mapping
>
56
57
????
<!--
?uncomment?this?if?you?want?the?admin?servlet?
-->
58
????
<!--
59
????????<servlet-mapping>
60
????????<servlet-name>AdminServlet</servlet-name>
61
????????<url-pattern>/servlet/AdminServlet</url-pattern>
62
????????</servlet-mapping>
63
????
-->
64
65
????
<
session-config
>
66
????????
<!--
?Default?to?5?minute?session?timeouts?
-->
67
????????
<
session-timeout
>
5
</
session-timeout
>
68
????
</
session-config
>
69
70
????
<!--
?currently?the?W3C?havent?settled?on?a?media?type?for?WSDL;
71
????????http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
72
????????for?now?we?go?with?the?basic?'it's?XML'?response?
-->
73
????
<
mime-mapping
>
74
????????
<
extension
>
wsdl
</
extension
>
75
????????
<
mime-type
>
text/xml
</
mime-type
>
76
????
</
mime-mapping
>
77
78
79
????
<
mime-mapping
>
80
????????
<
extension
>
xsd
</
extension
>
81
????????
<
mime-type
>
text/xml
</
mime-type
>
82
????
</
mime-mapping
>
83
84
????
<
welcome-file-list?
id
="WelcomeFileList"
>
85
????????
<
welcome-file
>
index.jsp
</
welcome-file
>
86
????????
<
welcome-file
>
index.html
</
welcome-file
>
87
????????
<
welcome-file
>
index.jws
</
welcome-file
>
88
????
</
welcome-file-list
>
89
</
web-app
>

?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

這個代碼你可以從官方下載的示例包中得到.也可以直接copy我的代碼.
這樣,一個axis的環境已經建立起來.在下面的篇章中.我們將建立我們的第一個例子
posted on 2006-04-29 17:40 jackyhuang 閱讀(922) 評論(1) 編輯 收藏