![使用axis自動生成webservice客戶端代碼_第1頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/15/7cd6f330-a08b-49d1-adcc-d2570c6e4b11/7cd6f330-a08b-49d1-adcc-d2570c6e4b111.gif)
![使用axis自動生成webservice客戶端代碼_第2頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/15/7cd6f330-a08b-49d1-adcc-d2570c6e4b11/7cd6f330-a08b-49d1-adcc-d2570c6e4b112.gif)
![使用axis自動生成webservice客戶端代碼_第3頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/15/7cd6f330-a08b-49d1-adcc-d2570c6e4b11/7cd6f330-a08b-49d1-adcc-d2570c6e4b113.gif)
![使用axis自動生成webservice客戶端代碼_第4頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/15/7cd6f330-a08b-49d1-adcc-d2570c6e4b11/7cd6f330-a08b-49d1-adcc-d2570c6e4b114.gif)
![使用axis自動生成webservice客戶端代碼_第5頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/15/7cd6f330-a08b-49d1-adcc-d2570c6e4b11/7cd6f330-a08b-49d1-adcc-d2570c6e4b115.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、利用AXIS生成客戶端文件,使得開發(fā)webservice更加簡單,以下是我的個(gè)人代碼,工具:Myeclipse7.0,axis1.4,tomcat5.5,jdk1.5一、 下載axis的jar包,我的是axis-bin-1_4.zip包,解壓后有axis的lib目錄,一會兒我們要用,二、 在myeclip se中創(chuàng)建自己的webservice工程,這個(gè)在的文庫里有,三、 在C盤目錄下創(chuàng)建一個(gè)批處理文件,我的名字是wsdltojava.bat,內(nèi)容如下:set Axis_Lib=E:jaraxisasixToolaxis-bin-1_4axis-1_4libset Java_Cmd=java -
2、Djava.ext.dirs=%Axis_Lib%set Axis_Servlet=%Java_Cmd% org.apache.axis.wsdl.WSDL2Java -u %Axis_Servlet%備注:紅色字體我的axis的目錄,也就是剛才我解壓出來的axis, 藍(lán)色是我的webservice的訪問地址,其他的不用處理,然后雙擊這個(gè)文件,產(chǎn)生以下幾個(gè)文件:(1)、目錄是:C:localhostmyAxisservicesHelloWorld(2)、四、 將這四個(gè)文件拷貝到你的客戶端,創(chuàng)建客戶端運(yùn)行即可附錄代碼:服務(wù)端HelloWorld.javapackage webservice.ax
3、is.test;public class HelloWorld public String hello()return "Hello "+"aaaaaaaaaaaaaaaaaa"客戶端(通過剛才命令生成的四個(gè)文件)HelloWorld.java/* * HelloWorld.java * * This auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */package webservice.axis.test.
4、batClient;public interface HelloWorld extends java.rmi.Remote public java.lang.String hello() throws java.rmi.RemoteException;HelloWorldService.java/* * HelloWorldService.java * * This auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */package webservi
5、ce.axis.test.batClient;public interface HelloWorldService extends javax.xml.rpc.Service public java.lang.String getHelloWorldAddress(); public webservice.axis.test.batClient.HelloWorld getHelloWorld() throws javax.xml.rpc.ServiceException; public webservice.axis.test.batClient.HelloWorld getHelloWor
6、ld(.URL portAddress) throws javax.xml.rpc.ServiceException;HelloWorldServiceLocator.java/* * HelloWorldServiceLocator.java * * This auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */package webservice.axis.test.batClient;public class HelloWorldService
7、Locator extends org.apache.axis.client.Service implements webservice.axis.test.batClient.HelloWorldService public HelloWorldServiceLocator() public HelloWorldServiceLocator(org.apache.axis.EngineConfiguration config) super(config); public HelloWorldServiceLocator(java.lang.String wsdlLoc, javax.xml.
8、namespace.QName sName) throws javax.xml.rpc.ServiceException super(wsdlLoc, sName); / Use to get a proxy class for HelloWorld private java.lang.String HelloWorld_address = "" public java.lang.String getHelloWorldAddress() return HelloWorld_address; / The WSDD service name defaults to the p
9、ort name. private java.lang.String HelloWorldWSDDServiceName = "HelloWorld" public java.lang.String getHelloWorldWSDDServiceName() return HelloWorldWSDDServiceName; public void setHelloWorldWSDDServiceName(java.lang.String name) HelloWorldWSDDServiceName = name; public webservice.axis.test
10、.batClient.HelloWorld getHelloWorld() throws javax.xml.rpc.ServiceException .URL endpoint; try endpoint = new .URL(HelloWorld_address); catch (.MalformedURLException e) throw new javax.xml.rpc.ServiceException(e); return getHelloWorld(endpoint); public webservice.axis.test.batClient.HelloWorld getHe
11、lloWorld(.URL portAddress) throws javax.xml.rpc.ServiceException try webservice.axis.test.batClient.HelloWorldSoapBindingStub _stub = new webservice.axis.test.batClient.HelloWorldSoapBindingStub(portAddress, this); _stub.setPortName(getHelloWorldWSDDServiceName(); return _stub; catch (org.apache.axi
12、s.AxisFault e) return null; public void setHelloWorldEndpointAddress(java.lang.String address) HelloWorld_address = address; /* * For the given interface, get the stub implementation. * If this service has no port for the given interface, * then ServiceException is thrown. */ public java.rmi.Remote
13、getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException try if (webservice.axis.test.batClient.HelloWorld.class.isAssignableFrom(serviceEndpointInterface) webservice.axis.test.batClient.HelloWorldSoapBindingStub _stub = new webservice.axis.test.batClient.HelloWorldSoapBindingSt
14、ub(new .URL(HelloWorld_address), this); _stub.setPortName(getHelloWorldWSDDServiceName(); return _stub; catch (java.lang.Throwable t) throw new javax.xml.rpc.ServiceException(t); throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpoi
15、ntInterface = null ? "null" : serviceEndpointInterface.getName(); /* * For the given interface, get the stub implementation. * If this service has no port for the given interface, * then ServiceException is thrown. */ public java.rmi.Remote getPort(space.QName portName, Class
16、 serviceEndpointInterface) throws javax.xml.rpc.ServiceException if (portName = null) return getPort(serviceEndpointInterface); java.lang.String inputPortName = portName.getLocalPart(); if ("HelloWorld".equals(inputPortName) return getHelloWorld(); else java.rmi.Remote _stub = getPort(serv
17、iceEndpointInterface); (org.apache.axis.client.Stub) _stub).setPortName(portName); return _stub; public space.QName getServiceName() return new space.QName("", "HelloWorldService"); private java.util.HashSet ports = null; public java.util.Iterator getP
18、orts() if (ports = null) ports = new java.util.HashSet(); ports.add(new space.QName("", "HelloWorld"); return ports.iterator(); /* * Set the endpoint address for the specified port name. */ public void setEndpointAddress(java.lang.String portName, java.lang.String a
19、ddress) throws javax.xml.rpc.ServiceException if ("HelloWorld".equals(portName) setHelloWorldEndpointAddress(address); else / Unknown Port Name throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); /* * Set the endpoint address for
20、the specified port name. */ public void setEndpointAddress(space.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException setEndpointAddress(portName.getLocalPart(), address); HelloWorldSoapBindingStub.java/* * HelloWorldSoapBindingStub.java * * This auto-generat
21、ed from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */package webservice.axis.test.batClient;public class HelloWorldSoapBindingStub extends org.apache.axis.client.Stub implements webservice.axis.test.batClient.HelloWorld private java.util.Vector cachedSerClasses = ne
22、w java.util.Vector(); private java.util.Vector cachedSerQNames = new java.util.Vector(); private java.util.Vector cachedSerFactories = new java.util.Vector(); private java.util.Vector cachedDeserFactories = new java.util.Vector(); static org.apache.axis.description.OperationDesc _operations; static
23、_operations = new org.apache.axis.description.OperationDesc1; _initOperationDesc1(); private static void _initOperationDesc1() org.apache.axis.description.OperationDesc oper; org.apache.axis.description.ParameterDesc param; oper = new org.apache.axis.description.OperationDesc(); oper.setName("h
24、ello"); oper.setReturnType(new space.QName("", "string"); oper.setReturnClass(java.lang.String.class); oper.setReturnQName(new space.QName("", "helloReturn"); oper.setStyle(org.apache.axis.constants.Style.RPC); oper.setUse(org.
25、apache.axis.constants.Use.ENCODED); _operations0 = oper; public HelloWorldSoapBindingStub() throws org.apache.axis.AxisFault this(null); public HelloWorldSoapBindingStub(.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault this(service); super.cachedEndpoint = endpointUR
26、L; public HelloWorldSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault if (service = null) super.service = new org.apache.axis.client.Service(); else super.service = service; (org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2"); protected
27、 org.apache.axis.client.Call createCall() throws java.rmi.RemoteException try org.apache.axis.client.Call _call = super._createCall(); if (super.maintainSessionSet) _call.setMaintainSession(super.maintainSession); if (super.cachedUsername != null) _call.setUsername(super.cachedUsername); if (super.c
28、achedPassword != null) _call.setPassword(super.cachedPassword); if (super.cachedEndpoint != null) _call.setTargetEndpointAddress(super.cachedEndpoint); if (super.cachedTimeout != null) _call.setTimeout(super.cachedTimeout); if (super.cachedPortName != null) _call.setPortName(super.cachedPortName); j
29、ava.util.Enumeration keys = super.cachedProperties.keys(); while (keys.hasMoreElements() java.lang.String key = (java.lang.String) keys.nextElement(); _call.setProperty(key, super.cachedProperties.get(key); return _call; catch (java.lang.Throwable _t) throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 山東省日照市高三下學(xué)期3月模擬考試語文試題(含答案)
- 工程車運(yùn)輸簡單合同
- 2025合同模板化工產(chǎn)品購銷合同范本
- 洗煤廠承包合同
- 商鋪個(gè)人租房合同
- 職稱聘任合同書
- 演講稿格式及范文二十-多篇
- 提升學(xué)習(xí)能力
- 農(nóng)產(chǎn)品產(chǎn)銷對接合作合同
- 二手房獨(dú)家代理合同
- 《共情的力量》課件
- 2022年中國電信維護(hù)崗位認(rèn)證動力專業(yè)考試題庫大全-上(單選、多選題)
- 《電氣作業(yè)安全培訓(xùn)》課件
- 水平二(四年級第一學(xué)期)體育《小足球(18課時(shí))》大單元教學(xué)計(jì)劃
- 《關(guān)于時(shí)間管理》課件
- 醫(yī)藥高等數(shù)學(xué)智慧樹知到課后章節(jié)答案2023年下浙江中醫(yī)藥大學(xué)
- 城市道路智慧路燈項(xiàng)目 投標(biāo)方案(技術(shù)標(biāo))
- 水泥采購?fù)稑?biāo)方案(技術(shù)標(biāo))
- 醫(yī)院招標(biāo)采購管理辦法及實(shí)施細(xì)則(試行)
- 初中英語-Unit2 My dream job(writing)教學(xué)設(shè)計(jì)學(xué)情分析教材分析課后反思
- 廣州市勞動仲裁申請書
評論
0/150
提交評論