加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Axis2webservice发布

发布时间:2020-12-16 22:54:58 所属栏目:安全 来源:网络整理
导读:web.xml配置: servlet servlet-nameAxisServlet/servlet-name servlet-classorg.apache.axis2.transport.http.AxisServlet/servlet-class !--init-param -- !--param-nameaxis2.xml.path/param-name -- !--param-value/WEB-INF/conf/axis2.xml/param-value

web.xml配置:

<servlet>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
<!--<init-param> -->
<!--<param-name>axis2.xml.path</param-name> -->
<!--<param-value>/WEB-INF/conf/axis2.xml</param-value> -->
<!--<param-name>axis2.xml.url</param-name> -->
<!--<param-value>http://localhost/myrepo/axis2.xml</param-value> -->
<!--<param-name>axis2.repository.path</param-name> -->
<!--<param-value>/WEB-INF</param-value> -->
<!--<param-name>axis2.repository.url</param-name> -->
<!--<param-value>http://localhost/myrepo</param-value> -->
<!--</init-param> -->
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>

1.classes下面有META-INF文件夹下有services.xml文件,用于配置接口信息

2.services.xml内容:

<service name="ParkingService">
? ? <description>
? ? ? ? ParkingService
? ? </description>
? ? <parameter name="ServiceObjectSupplier">
? ? ? ? org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier
? ? </parameter>
? ? <parameter name="SpringBeanName">
? ? ? ? ParkingService
? ? </parameter>
? ? <messageReceivers>
? ? <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
? ? ? ? ? ? class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
? ? ? ? <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
? ? ? ? ? ? class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
? ? </messageReceivers>
</service>?

3.build.xml文件,要么通过jar命令打包成aar文件

? ? <target name="generate.service" >
? ? <mkdir dir="${classes.dir}"/>
? ? ? ? <jar destfile="${lib.info}/services/ParkingService.aar">
? ? ? ? ? ? <fileset includes="${lib.info}/META-INF/services.xml" dir="${classes.dir}"/>
? ? ? ? </jar>
? ? </target>

4.将aar文件,放于WEB-INF/services目录下

5.即可通过地址访问wsdl即成功


/*******************************************************maven发布*****************************************************/

<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> ?? ? ? ?<artifactId>maven-war-plugin</artifactId> ?? ? ?<configuration> ? ? ? ? <warSourceExcludes> ? ? ? ? WEB-INF/lib/a*.jar,WEB-INF/lib/b*.jar,WEB-INF/lib/d*.jar,WEB-INF/lib/e*.jar,? ? ? ? WEB-INF/lib/f*.jar,WEB-INF/lib/g*.jar,WEB-INF/lib/h*.jar,WEB-INF/lib/i*.jar,? ? ? ? WEB-INF/lib/j*.jar,WEB-INF/lib/k*.jar,WEB-INF/lib/l*.jar,WEB-INF/lib/m*.jar,? ? ? ? WEB-INF/lib/n*.jar,WEB-INF/lib/o*.jar,WEB-INF/lib/p*.jar,WEB-INF/lib/q*.jar,? ? ? ? WEB-INF/lib/r*.jar,WEB-INF/lib/s*.jar,WEB-INF/lib/t*.jar,WEB-INF/lib/u*.jar,? ? ? ? WEB-INF/lib/v*.jar,WEB-INF/lib/w*.jar,WEB-INF/lib/x*.jar,WEB-INF/lib/X*.jar,? ? ? ? WEB-INF/lib/y*.jar,WEB-INF/lib/z*.jar,WEB-INF/lib/cms-license-*.jar,? ? ? ? WEB-INF/lib/commons*.jar,WEB-INF/lib/c3p0*.jar,WEB-INF/lib/cas*.jar,? ? ? ? WEB-INF/lib/cglib*.jar,WEB-INF/lib/camel*.jar ? ? ? ? </warSourceExcludes> ? ? ? ? <outputDirectory>target/war</outputDirectory> ? ? </configuration> ?? </plugin> <plugin> ? ?<groupId>org.apache.maven.plugins</groupId> ? ?<artifactId>maven-dependency-plugin</artifactId> ? ?<executions> ? ? ? ?<execution> ? ? ? ? ? ?<id>copy-dependencies</id> ? ? ? ? ? ?<phase>package</phase> ? ? ? ? ? ?<goals> ? ? ? ? ? ? ? ?<goal>copy-dependencies</goal> ? ? ? ? ? ?</goals> ? ? ? ? ? ?<configuration> ? ? ? ? ? ? <excludeScope>provided</excludeScope> ? ? ? ? ? ? ? ?<outputDirectory>../target/sharedlib</outputDirectory> ? ? ? ? ? ? ? ?<overWriteReleases>false</overWriteReleases> ? ? ? ? ? ? ? ?<overWriteSnapshots>false</overWriteSnapshots> ? ? ? ? ? ? ? ?<overWriteIfNewer>true</overWriteIfNewer> ? ? ? ? ? ?</configuration> ? ? ? ?</execution> ? ?</executions> </plugin> <plugin> <groupId>org.apache.axis2</groupId> <artifactId>axis2-java2wsdl-maven-plugin</artifactId> <version>1.5.4</version> <executions> <execution> <id>PmsTerminalService</id> <phase>process-classes</phase> <goals> <goal>java2wsdl</goal> </goals> <configuration> <className>com.hikvision.cms.pms.api.ws.server.impl.WsPmsTerminalService</className> <locationUri>http://localhost/pms/services/IWsPmsTerminalService</locationUri> <outputFileName>${project.build.directory}/wsdl/IWsPmsTerminalService.wsdl</outputFileName> </configuration> </execution> <execution> <id>PmsSelfhelpService</id> <phase>process-classes</phase> <goals> <goal>java2wsdl</goal> </goals> <configuration> <className>com.hikvision.cms.pms.api.ws.server.impl.WsPmsSelfhelpService</className> <locationUri>http://localhost/pms/services/IWsPmsSelfhelpService</locationUri> <outputFileName>${project.build.directory}/wsdl/IWsPmsSelfhelpService.wsdl</outputFileName> </configuration> </execution> <execution> <id>PmsCentralService</id> <phase>process-classes</phase> <goals> <goal>java2wsdl</goal> </goals> <configuration> <className>com.hikvision.cms.pms.api.ws.server.impl.WsPmsCentralService</className> <locationUri>http://localhost/pms/services/IWsPmsCentralService</locationUri> <outputFileName>${project.build.directory}/wsdl/IWsPmsCentralService.wsdl</outputFileName> </configuration> </execution> <execution> <id>PmsEpsService</id> <phase>process-classes</phase> <goals> <goal>java2wsdl</goal> </goals> <configuration> <className>com.hikvision.cms.pms.api.ws.server.impl.WsPmsEpsService</className> <locationUri>http://localhost/pms/services/IWsPmsEpsService</locationUri> <outputFileName>${project.build.directory}/wsdl/IWsPmsEpsService.wsdl</outputFileName> </configuration> </execution> </executions> </plugin> </plugins> <pluginManagement> <plugins> <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId> org.apache.axis2 </groupId> <artifactId> axis2-java2wsdl-maven-plugin </artifactId> <versionRange> [1.5.4,) </versionRange> <goals> <goal>java2wsdl</goal> </goals> </pluginExecutionFilter> <action> <ignore></ignore> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> </build>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读