怎么样在Eclipse+Myeclipse中使用AXIS开发WEB SERVICES?
前期做一个项目,是要做个WEB SERVICES相关的东西,本来采用XFIRE进行开发,但在开发过程中发现在XFIRE中有些JAR包与项目中其它的JAR包发生冲突,所以只有改用AXIS进行,在网上查了很多资料,不过大都讲的比较含糊,试了很久最后终于在MYECLIPSE中直接使用AXIS进行开发,今天将此贴出来,请大家多多指教;
第一步:在ECLIPSE中新建一个WEB工程,并将下载下来的AXIS源文件下面的axis/WEB-INF/lib下的JAR包添加到WEB工程中,并将axis/WEB-INF下的web.xml替换myeclipse中自动生成的web.xml.
第二步:在src下面新建package,并取名为com,添加一个类文件到些包下面,
第三步:添加server-config.wsdd文件,这个文件是通过ANT自动生成,在这里我直接将些文件贴出,其中自定义配置类项为第一步编写的类,
注:"*"表示将类的所有方法作为WEB METHOD,如需更改,可直接将"*"换成方法名就可以了
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<globalConfiguration>
<parameter name="adminPassword" value="admin"/>
<parameter name="enableNamespacePrefixOptimization" value="false"/>
<parameter name="dotNetSoapEncFix" value="true"/>
<parameter name="disablePrettyXML" value="true"/>
<parameter name="sendMultiRefs" value="true"/>
<parameter name="sendXsiTypes" value="true"/>
<parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
<parameter name="sendXMLDeclaration" value="true"/>
<requestFlow>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="session"/>
</handler>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="request"/>
<parameter name="extension" value=".jwr"/>
</handler>
</requestFlow>
</globalConfiguration>
<handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/>
<handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/>
<handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
<service name="AdminService" provider="java:MSG">
<parameter name="allowedMethods" value="AdminService"/>
<parameter name="enableRemoteAdmin" value="false"/>
<parameter name="className" value="org.apache.axis.utils.Admin"/>
<namespace>http://xml.apache.org/axis/wsdd/</namespace>
</service>
<service name="Version" provider="java:RPC">
<parameter name="allowedMethods" value="getVersion"/>
<parameter name="className" value="org.apache.axis.Version"/>
</service>
<!-- 配置自定义类 -->
<service name="MessageServices" provider="java:RPC">
<parameter name="allowedMethods" value="*"/>
<parameter name="className" value="com.MessageServices"/>
</service>
<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
<handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
</requestFlow>
<parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
<parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler"/>
</transport>
<transport name="local">
<responseFlow>
<handler type="LocalResponder"/>
</responseFlow>
</transport>
</deployment>
本文地址:http://www.45fan.com/dnjc/68992.html