AXIS1.4 DOC 阅读笔记

原文地址:[url]http://www.blogjava.net/ponzmd/articles/142045.html[/url]

说明:这部分只要是Axis1.4Doc的摘要,只截取了我不明白和感兴趣的部分。可以当作一个快速索引和入门资料来看,如有不明白可直接查看Axis1.4的发布文档。
欢迎转载,但是请注明出处,转载地址:http://www.blogjava.net/ponzmd/articles/142045.html


[size=xx-large][align=center]AXIS1.4 DOC 阅读笔记 [/align][/size]

[color=darkred][size=x-large]安装介绍[/size][/color]

[size=large][color=red]作为单独WebApplication安装 [/color][/size]
[list]
[*]Step1:拷贝AXIS工程/webapps/axis到相应web服务器的部署目录即可
[*]Step2:启动web服务器.访问: http://127.0.0.1:8080/axis/ 和 http://localhost:8080/axis/happyaxis.jsp ;如不正常改正错误即可
[*]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 .
[/list]
[size=large][color=red]集成AXIS [/color][/size]
[list]
[*]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
[/list]
[size=large][color=red]遗留问题(没有配置成功) [/color][/size]
如何配置使用SOAPMonitor?
[size=large][color=red]注意事项 [/color][/size]
配置Classpath一定要加入所有的Jar包,少一个都会错

[color=darkred][size=x-large]用户向导[/size][/color]
[size=large][color=red]什么是AXIS [/color][/size]
AXIS: Apache EXtensible Interaction System
[size=large][color=red]AXIS包括什么?[/color][/size]
[list]
[*]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
[/list]
[size=large][color=red]部署WebService [/color][/size]
[list]
[*]方式1:JWS:将需要部署的WebService的源文件改扩展名.java为.jws,将其至于工程的根目录下面,发布即告完成。需要注意的是:要部署的文件只能使用默认包。
[*]方式2:WSDD:编写WSDD文件,通过执行org.apache.axis.client.AdminClient来部署。也可以通过此类撤销已部署的WebService服务。
[/list]

配置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"/> 

扩展配置:参照《Reference Material 》

[size=large][color=red]访问WebService [/color][/size]
编写服务访问客户端,并执行之(必要步骤,example3为例)
Step1:获取服务的访问地址:
String endpointURL = "http://localhost:8080/axis/services/MyService";  

Step2:构建Service 和 Call对象:
Service service = new Service(); Call call = (Call) service.createCall(); 

Step3:确定访问目标:
call.setTargetEndpointAddress( new java.net.URL(endpointURL) ); call.setOperationName( new QName("http://example3.userguide.samples", "serviceMethod") ); 

Step4:(可选) 配置参数类型:
call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING ); 

Step5:发起访问,并获取反馈:
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服务器描述语言是用XML文档来描述Web服务的标准,是Web服务的接口定义语言,由Ariba、Intel、IBM、MS等共同提出,通过WSDL,可描述Web服务的三个基本属性:
[list]
[*]服务做些什么——服务所提供的操作(方法)
[*]如何访问服务——和服务交互的数据格式以及必要协议
[*]服务位于何处——协议相关的地址,如URL
[/list]

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服务接口 WidgetPriceService.java: 定义了用于获取Web服务接口的方法。 WidgetPriceServiceLocator.java: 定义了用于获取Web服务接口的方法。 WidgetPriceSoapBindingStub.java:Web服务客户端桩,通过该类与服务器交互。 WidgetPriceSoapBindingSkeleton.java: Server side skeleton. deploy.wsdd: Deployment descriptor undeploy.wsdd: Undeployment descriptor 这几个JAVA类帮我们处理了大部分的逻辑,我们需要的仅仅是把这些类加到我们的项目然后创建一个我们自己的类来调用它们即可

Step3:编写客户端代码: 通过***ServiceLocator构造***Service方法,通过***Service对象获得提供服务的类对象,进而调用提供服务类对象上的方法,提供服务。

[size=large][color=red]工具使用 [/color][/size]
the Axis TCP Monitor :java org.apache.axis.utils.tcpmon [listenPort targetHost targetPort]
the SOAP Monitor :

[color=darkred][size=x-large]WebService安全 [/size][/color]
[size=large][color=red]常见攻击方式 [/color][/size]
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
[size=large][color=red]判断来访者[/color][/size]
AXIS不支持判断请求服务的是谁.可以使用 xmlsec.jar来支援它
AXIS推荐使用HTTPS来加强这种安全性
Axis 不支持HTTP1.1 Digest Authentication,需要the HttpClient libraries配合工作
[size=large][color=red]可考虑的安全措施 [/color][/size]
Disguise:不要让人知道你运行了AXIS
Cut down the build: 仅仅保留你需要的部分
Rename things:换掉默认的名称,如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(没明白)

[color=darkred][size=x-large]AXIS ANT Task [/size][/color]

在axis-ant.jar中定义
[b]主要任务[/b]
Creating Java files from WSDL
Creating WSDL files from Java
Talking to the admin service
[b]具体配置看文档 [/b]
《Reference Material》
其中注意包括了WSDL2JAVA,JAVA2WSDL的具体使用,以及WSDD的配置信息等技术细节
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值