posts - 110,  comments - 152,  trackbacks - 0
          說明:這部分只要是Axis1.4Doc的摘要,只截取了我不明白和感興趣的部分??梢援?dāng)作一個(gè)快速索引和入門資料來看,如有不明白可直接查看Axis1.4的發(fā)布文檔。
          歡迎轉(zhuǎn)載,但是請注明出處,轉(zhuǎn)載地址:
          http://www.aygfsteel.com/ponzmd/articles/142045.html
          • AXIS1.4 DOC 閱讀筆記
            • 安裝介紹
              • 作為單獨(dú)WebApplication安裝
                • Step1:拷貝AXIS工程/webapps/axis到相應(yīng)web服務(wù)器的部署目錄即可
                • Step2:啟動(dòng)web服務(wù)器.訪問: http://127.0.0.1:8080/axis/ 和 http://localhost:8080/axis/happyaxis.jsp ;如不正常改正錯(cuò)誤即可
                • Step3:Test a SOAP Endpoint:http://localhost:8080/axis/services/Version?method=getVersion
                • Step4:Test a JWS Endpoint http://localhost:8080/axis/EchoHeaders.jws?method=list .
              • 集成AXIS
                • 1.Add axis.jar, wsdl.jar, saaj.jar, jaxrpc.jar and the other dependent libraries to your WAR file.
                • 2.Copy all the Axis Servlet declarations and mappings from axis/WEB-INF/web.xml and add them to your own web.xml
                • 3.Build and deploy your webapp.
                • 4.Run the Axis AdminClient against your own webapp, instead of Axis, by changing the URL you invoke it with
              • 遺留問題(沒有配置成功)
                •   如何配置使用SOAPMonitor?
              • 注意事項(xiàng)
                • 配置Classpath一定要加入所有的Jar包,少一個(gè)都會(huì)錯(cuò)
            • 用戶向?qū)?/span>
              • 什么是AXIS
                • AXIS: Apache EXtensible Interaction System
              • AXIS包括什么?
                • a SOAP engine -- a framework for constructing SOAP processors such as clients, servers, gateways
                • a simple stand-alone server
                • a server which plugs into servlet engines such as Tomcat
                • extensive support for the Web Service Description Language (WSDL)
                • emitter tooling that generates Java classes from WSDL
                • some sample programs,anda tool for monitoring TCP/IP packets
              • 使用AXIS
                • 部署WebService
                  • 方式1:JWS:將需要部署的WebService的源文件改擴(kuò)展名.java為.jws,將其至于工程的根目錄下面,發(fā)布即告完成。需要注意的是:要部署的文件只能使用默認(rèn)包。
                  • 方式2:WSDD:編寫WSDD文件,通過執(zhí)行org.apache.axis.client.AdminClient來部署。也可以通過此類撤銷已部署的WebService服務(wù)。
                  • 配置WSDD,通過org.apache.axis.client.AdminClient來部署
                    • WSDD: Web Service Deployment Descriptor
                    • 基本配置:
                      <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="MyService" provider="java:RPC"> <parameter name="className" value="samples.userguide.example3.MyService"/> <parameter name="allowedMethods" value="*"/> </service> </deployment>  
                    • 常用配置:配置JavaBean 客戶端代碼:
                      QName qn = new QName( "urn:BeanService""Order" ); call.registerTypeMapping(Order.class, qn, new org.apache.axis.encoding.ser.BeanSerializerFactory(Order.class, qn), new org.apache.axis.encoding.ser.BeanDeserializerFactory(Order.class, qn)); 
                      WSDD文件:
                      <beanMapping qname="myNS:Order" xmlns:myNS="urn:BeanService" languageSpecificType="java:samples.userguide.example5.Order"/> 
                      擴(kuò)展配置:參照《Reference Material 》
                • 訪問WebService
                  • 編寫服務(wù)訪問客戶端,并執(zhí)行之(必要步驟,example3為例)
                    • Step1:獲取服務(wù)的訪問地址:
                      String endpointURL = “http://localhost:8080/axis/services/MyService"; 
                       
                    •  Step2:構(gòu)建Service 和 Call對象:
                       Service service = new Service(); Call call = (Call) service.createCall(); 
                    • Step3:確定訪問目標(biāo):
                      call.setTargetEndpointAddress( new java.net.URL(endpointURL) ); call.setOperationName( new QName("http://example3.userguide.samples""serviceMethod") ); 
                    • Step4:(可選) 配置參數(shù)類型:
                       call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING ); 
                    • Step5:發(fā)起訪問,并獲取反饋:
                      String ret = (String) call.invoke( new Object[] { textToSend } ); 
                    • Step6:處理異常:
                      try {//上面那些  } catch (AxisFault fault) {et = "Error : " + fault.toString();} 
                  • 通過WSDL來訪問WebService(必要步驟,以Example6為例)
                    • WSDL: Web Service Description Language Web服務(wù)器描述語言是用XML文檔來描述Web服務(wù)的標(biāo)準(zhǔn),是Web服務(wù)的接口定義語言,由Ariba、Intel、IBM、MS等共同提出,通過WSDL,可描述Web服務(wù)的三個(gè)基本屬性:? 服務(wù)做些什么——服務(wù)所提供的操作(方法) ?#22914;何訪問服務(wù)——和服務(wù)交互的數(shù)據(jù)格式以及必要協(xié)議 ?#26381;務(wù)位于何處——協(xié)議相關(guān)的地址,如URL
                    • Step1:獲得WSDL文件
                      • 方式1:?WSDL http://<host>/axis/services/<service-name>?wsdl http://<host>/axis/*.jws?wsdl
                      • 方式2:JAVA2WSDL工具 % java org.apache.axis.wsdl.Java2WSDL -o wp.wsdl -l"http://localhost:8080/axis/services/WidgetPrice" -n "urn:Example6" -p"samples.userguide.example6" "urn:Example6" samples.userguide.example6.WidgetPrice
                        Where: -o indicates the name of the output WSDL file -l indicates the location of the service -n is the target namespace of the WSDL file -p indicates a mapping from the package to a namespace. There may be multiple mappings. the class specified contains the interface of the webservice.
                    • Step2:通過WSDL2JAVA工具獲得輔助類 % java org.apache.axis.wsdl.WSDL2Java -o . -d Session -s -S true -N urn:Example6 samples.userguide.example6 wp.wsdl
                      WidgetPriceSoapBindingImpl.java : Java file containing the default server implementation of the WidgetPrice web service. You will need to modify the *SoapBindingImpl file to add your implementation WidgetPrice.java: 定義了Web服務(wù)接口 WidgetPriceService.java: 定義了用于獲取Web服務(wù)接口的方法。 WidgetPriceServiceLocator.java: 定義了用于獲取Web服務(wù)接口的方法。 WidgetPriceSoapBindingStub.java:Web服務(wù)客戶端樁,通過該類與服務(wù)器交互。 WidgetPriceSoapBindingSkeleton.java: Server side skeleton. deploy.wsdd: Deployment descriptor undeploy.wsdd: Undeployment descriptor 這幾個(gè)JAVA類幫我們處理了大部分的邏輯,我們需要的僅僅是把這些類加到我們的項(xiàng)目然后創(chuàng)建一個(gè)我們自己的類來調(diào)用它們即可
                    • Step3:編寫客戶端代碼: 通過***ServiceLocator構(gòu)造***Service方法,通過***Service對象獲得提供服務(wù)的類對象,進(jìn)而調(diào)用提供服務(wù)類對象上的方法,提供服務(wù)。
                • 工具使用
                  • the Axis TCP Monitor :java org.apache.axis.utils.tcpmon [listenPort targetHost targetPort]
                  • the SOAP Monitor :
            • WebService安全
              • 常見攻擊方式
                • Denial of Service to a server
                • Interception and manipulation of messages
                • Forged client requests or Forged server responses
                • attempts to read the server file system/database
                • Attempts to write to the server file system/database
              • 判斷來訪者
                • AXIS不支持判斷請求服務(wù)的是誰.可以使用 xmlsec.jar來支援它
                • AXIS推薦使用HTTPS來加強(qiáng)這種安全性
                • Axis 不支持HTTP1.1 Digest Authentication,需要the HttpClient libraries配合工作
              • 可考慮的安全措施
                • Disguise:不要讓人知道你運(yùn)行了AXIS
                • Cut down the build: 僅僅保留你需要的部分
                • Rename things:換掉默認(rèn)的名稱,如The AxisServlet, the AdminService, even happyaxis.jsp
                • Stop AxisServlet listing services :axis.enableListQuery =false
                • Keep stack traces out of the responses :axis.development.system =true
                • Edit the .wsdd configuration file, as described in the reference, to return a WSDL resource which is simply an empty <wsdl/> tag.
                • Servlets2.3: use filters for extra authentication
                • Log things
                • Run Axis with reduced Java rights
                • Run the web server with reduced rights
                • Monitor Load
                • Consider 'tripwire' and 'honeypot' endpoints(沒明白)
            • AXIS ANT Task
              • 在axis-ant.jar中定義
              • 主要任務(wù)
                • Creating Java files from WSDL
                • Creating WSDL files from Java
                • Talking to the admin service
                • 具體配置看文檔
            • 《Reference Material》
              • 其中注意包括了WSDL2JAVA,JAVA2WSDL的具體使用,以及WSDD的配置信息等技術(shù)細(xì)節(jié)


          平凡而簡單的人一個(gè),無權(quán)無勢也無牽無掛。一路廝殺,只進(jìn)不退,死而后已,豈不爽哉!
          收起對“車”日行千里的羨慕;收起對“馬”左右逢緣的感嘆;目標(biāo)記在心里面,向前進(jìn)。一次一步,一步一腳印,跬步千里。
          這個(gè)角色很適合現(xiàn)在的


          posted on 2007-09-02 11:51 過河卒 閱讀(2220) 評論(0)  編輯  收藏 所屬分類: Java/Java框架
          文章來自: http://www.blogjava.com/ponzmd/ (彭?。^河卒) 轉(zhuǎn)貼請聲明!
          訪問統(tǒng)計(jì):
          主站蜘蛛池模板: 嵊州市| 江阴市| 榆林市| 利川市| 尚志市| 八宿县| 塔河县| 巴东县| 汤阴县| 安仁县| 黄陵县| 五指山市| 文安县| 封开县| 侯马市| 广灵县| 平遥县| 区。| 北辰区| 德庆县| 皋兰县| 湛江市| 子洲县| 文成县| 东阳市| 焦作市| 乌兰县| 麻栗坡县| 枣阳市| 崇州市| 嫩江县| 沾益县| 和林格尔县| 永德县| 海口市| 易门县| 布尔津县| 六安市| 镇宁| 忻城县| 汉源县|