锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 銆銆1銆佸畨瑁呯幆澧?J2SE SDK 1.4錛孴omcat 5.0錛宔clipse 3.2銆?/p>
銆銆2銆佸埌 http://xml.apache.org 緗戠珯涓嬭澆Axis瀹夎鍖呫?/p>
銆銆3銆佸皢Axis鐩稿叧鍖呮枃浠舵斁鍦╓EB-INF\lib鐩綍涓嬨?/p>
銆銆4銆丄xis鍙夌殑鍖咃細activation.jar錛?mail.jar錛?xmlsec-1.4.Beta1.jar鎷瘋礉鍒癢EB-INF鐩綍涓嬶紝鐢熸垚瀹㈡埛绔椂鍊欓渶瑕佷嬌鐢ㄣ?/p>
銆銆Axis鏀寔涓夌web service鐨勯儴緗插拰寮鍙戯紝鍒嗗埆涓猴細 銆銆1銆丏ynamic Invocation Interface 錛圖II錛?/p>
銆銆2銆丏ynamic Proxy鏂瑰紡 銆銆3銆丼tubs鏂瑰紡 銆銆鍓嶄袱縐嶆柟寮忔垜灝變笉浠嬬粛浜嗭紝鍚屼簨鍛婅瘔鎴戜粬浠嚜宸遍兘涓嶄嬌鐢ㄥ墠涓ょ鏂瑰紡錛屼粬浠緩璁垜浠嬌鐢⊿tubs鏂瑰紡錛屽洜姝ゆ垜灝變富瑕佸氨浠嬬粛涓涓嬬涓夌鏂瑰紡銆傛敞鎰忥紝鎴戣嚜宸辯殑Java婧愪唬鐮佹槸鏀懼湪D錛歕workspace\test\鐩綍涓嬶紝Axis鐩稿叧鍖呮枃浠舵斁鍦―錛歕workspace\test\WEB-INF鐩綍涓嬨?/p>
銆銆浜屻佺紪鍐檞sdd鍙戝竷web鏈嶅姟錛岀紪鍐檚tub client璁塊棶web鏈嶅姟 銆銆1銆佺紪鍐欐湇鍔$紼嬪簭server錛孲ayHello.java錛岀紪璇憇erver.SayHello.java 銆銆deploy.wsdd鏂囦歡鍐呭濡備笅錛?/p>
銆銆緙栬緫涓涓猟eploy.bat錛孉xis_Lib涓篴xis.jar璺緞銆傚唴瀹瑰涓嬶細 銆銆4銆佺敓鎴愬鎴風client stub鏂囦歡 銆銆鍦ㄦ祻瑙堝櫒涓婅闂湇鍔″櫒绔殑鏈嶅姟錛屽彲浠ヤ笅杞藉埌WSDL鏂囦歡錛岄氳繃Axis鐨勭浉鍏沖伐鍏鳳紝鍙互鑷姩浠嶹SDL鏂囦歡涓敓鎴怶eb Service鐨勫鎴風浠g爜銆?/p>
銆銆緙栧啓涓涓猈SDL2Java.bat鏂囦歡錛屽叾鍐呭濡備笅錛?/p>
set Axis_Lib=D:\workspace\test\WEB-INF\lib 銆銆鐢熸垚鐨剆tub client鏂囦歡鍒楄〃涓猴細SayHello.java錛孲ayHelloService.java錛孲ayHelloServiceLocator.java錛孲ayHelloSoapBindingStub.java . 銆銆5銆佺紪鍐欏鎴風紼嬪簭錛岀紪璇戝茍鎵ц 銆銆涓嬮潰鏄竴孌礿unit嫻嬭瘯瀹㈡埛绔唬鐮併?/p>
package server;
2public class SayHello
3{
4 public String getName(String name)
5
{
6 return "hello "+name;
7 }
8}
9
10
銆2銆佺紪鍐檞sdd鏂囦歡
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
2 <service name="SayHello" provider="java:RPC">
3 <parameter name="className" value="server.SayHello.getName"/>
4 <parameter name="allowedMethods" value="*"/>
5 </service>
6</deployment>
7
8
3銆佸彂甯冩湇鍔★細
set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
set Axis_Servlet=http://localhost:8080/test/servlet/AxisServlet
%Java_Cmd% org.apache.axis.client.AdminClient -l%Axis_Servlet% deploy.wsdd
鎵ц榪欎釜鎵瑰鐞嗘枃浠訛紝榪欐椂鍊欙紝濡傛灉鎻愮ず鎴愬姛鐨勮瘽錛岃闂甴ttp://localhost:8080/test/services 灝變細鏄劇ず鏈嶅姟鍒楄〃銆?
set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
set Output_Path=D:\workspace\test\src
set Package=server.SayHello
%Java_Cmd% org.apache.axis.wsdl.WSDL2Java -o%Output_Path% -p%Package% SayHello.wsdl
鎵ц榪欎釜鎵瑰鐞嗘枃浠跺氨鍙互鐢熸垚client stub.
import java.net.URL;
2import junit.framework.Test;
3import junit.framework.TestCase;
4import junit.framework.TestSuite;
5
6public class TestWSClient extends TestCase
{
7
8 public TestWSClient(String string)
{
9 super(string);
10 }
11
12 public void SayHelloClient() throws Exception
{
13
14 SayHelloService service = new SayHelloServiceLocator();
15 SayHello_PortType client = service.getSayHello() ;
16 String retValue = client.getName("clientname");
17 System.out.println(retValue);
18
19 }
20
21 public static Test suite()
{
22 TestSuite suite = new TestSuite();
23 suite.addTest(new TestWSClient("SayHelloClient"));
24 return suite;
25 }
26}
27
28
鑷蟲錛屾暣涓湇鍔″櫒绔拰瀹㈡埛绔殑Web Service妗嗘灦浠g爜灝卞畬鎴愪簡錛屽墿涓嬬殑灝辨槸鍦ㄩ噷闈㈠姞鍏ヤ綘鐨勪笟鍔′唬鐮佷簡錛屾庝箞鏍鳳紝Web Service騫朵笉闅懼紑鍙戝惂銆?
]]>import java.text.ParseException;
2import java.text.SimpleDateFormat;
3import java.util.Date;
4
5 public int dispersionMonth2(String date)
{
6 Calendar objCalendarDatebig = Calendar.getInstance();
7 Calendar objCalendarDatesmall = Calendar.getInstance();
8 SimpleDateFormat DateFormat=new SimpleDateFormat("yyyy-MM-dd");
9 int iMonth=0;
10 int flag = 0;
11 Date datebig=new Date();
12 Date datesmall=new Date();
13 try
{
14 datesmall=DateFormat.parse(date);
15 objCalendarDatebig.setTime(datebig);
16 objCalendarDatesmall.setTime(datesmall);
17 if (objCalendarDatebig.after(objCalendarDatesmall) )
18
{
19 Calendar temp = objCalendarDatebig;
20 objCalendarDatebig= objCalendarDatesmall;
21 objCalendarDatesmall = temp;
22 }
23 if (objCalendarDatesmall.get(Calendar.DAY_OF_MONTH) < objCalendarDatebig.get(Calendar.DAY_OF_MONTH))
24 flag = 1;
25
26 if (objCalendarDatesmall.get(Calendar.YEAR) > objCalendarDatebig.get(Calendar.YEAR))
27 iMonth= ((objCalendarDatesmall.get(Calendar.YEAR) - objCalendarDatebig.get(Calendar.YEAR)) * 12
28 + objCalendarDatesmall.get(Calendar.MONTH) - flag) - objCalendarDatebig.get(Calendar.MONTH);
29 else
30 iMonth= objCalendarDatesmall.get(Calendar.MONTH)- objCalendarDatebig.get(Calendar.MONTH) - flag ;
31
32 } catch (ParseException e)
{
33 // TODO Auto-generated catch block
34 e.printStackTrace();
35 }
36 return iMonth;
37 }
38
]]>
.a
瑙e帇錛?tar xv file.a
---------------------------------------------
.cpio.gz/.cgz
瑙e帇錛歡zip -dc file.cgz | cpio -div
---------------------------------------------
.cpio/cpio
瑙e帇錛歝pio -div file.cpio 鎴朿pio -divc file.cpio
---------------------------------------------
.rpm
瀹夎: rpm -i file.rpm
瑙e帇錛歳pm2cpio file.rpm | cpio -div
---------------------------------------------
.deb
瀹夎: dpkg -i file.deb
瑙e帇錛歞pkg-deb --fsys-tarfile file.deb | tar xvf - ar p file.deb data.tar.gz | tar xvzf -
---------------------------------------------