一、使用axis用wsdl生成Webservice:

工具:有axis插件的eclipse,wsdl文件;

操作步骤:

新建工程--》选择wsdl文件--》右键选择Webservice--->Generate Java Bean Skeleton

为了自动生成server-config.wsdd文件 需要勾选上图所示地方;

  1. <ns1:deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:ns1="http://xml.apache.org/axis/wsdd/">
  2. <ns1:globalConfiguration>
  3. <ns1:parameter name="sendMultiRefs" value="true"/>
  4. <ns1:parameter name="disablePrettyXML" value="true"/>
  5. <ns1:parameter name="adminPassword" value="admin"/>
  6. <ns1:parameter name="attachments.Directory" value="F:\workspace_study\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\htmltest\WEB-INF\attachments"/>
  7. <ns1:parameter name="dotNetSoapEncFix" value="true"/>
  8. <ns1:parameter name="enableNamespacePrefixOptimization" value="false"/>
  9. <ns1:parameter name="sendXMLDeclaration" value="true"/>
  10. <ns1:parameter name="sendXsiTypes" value="true"/>
  11. <ns1:parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
  12. <ns1:requestFlow>
  13. <ns1:handler type="java:org.apache.axis.handlers.JWSHandler">
  14. <ns1:parameter name="scope" value="session"/>
  15. </ns1:handler>
  16. <ns1:handler type="java:org.apache.axis.handlers.JWSHandler">
  17. <ns1:parameter name="scope" value="request"/>
  18. <ns1:parameter name="extension" value=".jwr"/>
  19. </ns1:handler>
  20. </ns1:requestFlow>
  21. </ns1:globalConfiguration>
  22. <ns1:handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/>
  23. <ns1:handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/>
  24. <ns1:handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
  25. <ns1:service name="AdminService" provider="java:MSG">
  26. <ns1:parameter name="allowedMethods" value="AdminService"/>
  27. <ns1:parameter name="enableRemoteAdmin" value="false"/>
  28. <ns1:parameter name="className" value="org.apache.axis.utils.Admin"/>
  29. <ns1:namespace>http://xml.apache.org/axis/wsdd/</ns1:namespace>
  30. </ns1:service>
  31. <ns1:service name="Version" provider="java:RPC">
  32. <ns1:parameter name="allowedMethods" value="getVersion"/>
  33. <ns1:parameter name="className" value="org.apache.axis.Version"/>
  34. </ns1:service>
  35. <ns1:service name="ImportMaterialServiceHttpPort" provider="java:RPC" style="document" use="literal">
  36. <ns1:parameter name="allowedMethods" value="*"/>
  37. <ns1:parameter name="typeMappingVersion" value="1.2"/>
  38. <ns1:parameter name="wsdlPortType" value="ImportMaterial"/>
  39. <ns1:parameter name="className" value="com.dayang.ADP.service.ImportMaterialService._0_1.ImportMaterialHttpBindingSkeleton"/>
  40. <ns1:parameter name="wsdlServicePort" value="ImportMaterialServiceHttpPort"/>
  41. <ns1:parameter name="schemaQualified" value="http://dayang.com/ADP/schema/ADFileInfoEntity/1.0,http://dayang.com/ADP/schema/ADBroadcastListEntity/1.0,http://dayang.com/ADP/schema/ADPServiceParameterType/0.1,http://dayang.com/ADP/schema/ADMaterialEntity/1.0"/>
  42. <ns1:parameter name="wsdlTargetNamespace" value="http://dayang.com/ADP/service/ImportMaterialService/0.1"/>
  43. <ns1:parameter name="wsdlServiceElement" value="ImportMaterialService"/>
  44. <ns2:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns1:CommonRequestType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.dayang.ADP.schema.ADPServiceParameterType._0_1.CommonRequestType" xmlns:ns1="http://dayang.com/ADP/schema/ADPServiceParameterType/0.1" xmlns:ns2="http://xml.apache.org/axis/wsdd/"/>
  45. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns2:ImportMaterialRequestType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.dayang.ADP.schema.ADPServiceParameterType._0_1.ImportMaterialRequestType" xmlns:ns2="http://dayang.com/ADP/schema/ADPServiceParameterType/0.1"/>
  46. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns3:ADMaterialEntityType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.dayang.ADP.schema.ADMaterialEntity._1_0.ADMaterialEntityType" xmlns:ns3="http://dayang.com/ADP/schema/ADMaterialEntity/1.0"/>
  47. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns4:MaterialServiceParameterResponseType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.dayang.ADP.schema.ADPServiceParameterType._0_1.MaterialServiceParameterResponseType" xmlns:ns4="http://dayang.com/ADP/schema/ADPServiceParameterType/0.1"/>
  48. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns5:ExtendAttributeType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.dayang.ADP.schema.ADMaterialEntity._1_0.ExtendAttributeType" xmlns:ns5="http://dayang.com/ADP/schema/ADMaterialEntity/1.0"/>
  49. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns6:CommonResponseType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.dayang.ADP.schema.ADPServiceParameterType._0_1.CommonResponseType" xmlns:ns6="http://dayang.com/ADP/schema/ADPServiceParameterType/0.1"/>
  50. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns7:ExtendAttributeType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.dayang.ADP.schema.ADPServiceParameterType._0_1.ExtendAttributeType" xmlns:ns7="http://dayang.com/ADP/schema/ADPServiceParameterType/0.1"/>
  51. <ns1:arrayMapping innerType="ns8:ExtendAttributeType" languageSpecificType="java:com.dayang.ADP.schema.ADMaterialEntity._1_0.ExtendAttributeType[]" qname="ns8:ExtendAttributesType" xmlns:ns8="http://dayang.com/ADP/schema/ADMaterialEntity/1.0"/>
  52. <ns1:arrayMapping innerType="ns9:ExtendAttributeType" languageSpecificType="java:com.dayang.ADP.schema.ADPServiceParameterType._0_1.ExtendAttributeType[]" qname="ns9:ExtendAttributesType" xmlns:ns9="http://dayang.com/ADP/schema/ADPServiceParameterType/0.1"/>
  53. </ns1:service>
  54. <ns1:service name="ImportProgramListServiceHttpPort" provider="java:RPC" style="document" use="literal">
  55. <ns1:parameter name="allowedMethods" value="*"/>
  56. <ns1:parameter name="typeMappingVersion" value="1.2"/>
  57. <ns1:parameter name="wsdlPortType" value="ImportProgramList"/>
  58. <ns1:parameter name="className" value="MREML2.schema.ImportProgramListService.ImportProgramListHttpBindingSkeleton"/>
  59. <ns1:parameter name="wsdlServicePort" value="ImportProgramListServiceHttpPort"/>
  60. <ns1:parameter name="schemaQualified" value="http://MREML2/schema/ProgramListParameter,http://MREML2/schema/CommonDataType,http://MREML2/schema/ProgramList"/>
  61. <ns1:parameter name="wsdlTargetNamespace" value="http://MREML2/schema/ImportProgramListService"/>
  62. <ns1:parameter name="wsdlServiceElement" value="ImportProgramListService"/>
  63. <ns2:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns1:ImportProgramListRequestType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramListParameter.ImportProgramListRequestType" xmlns:ns1="http://MREML2/schema/ProgramListParameter" xmlns:ns2="http://xml.apache.org/axis/wsdd/"/>
  64. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns2:ColumnInfoType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramList.ColumnInfoType" xmlns:ns2="http://MREML2/schema/ProgramList"/>
  65. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns3:BroadcastListEntityType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramList.BroadcastListEntityType" xmlns:ns3="http://MREML2/schema/ProgramList"/>
  66. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns4:ExecuteActionType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramList.ExecuteActionType" xmlns:ns4="http://MREML2/schema/ProgramList"/>
  67. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns5:BroadcastListItemType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramList.BroadcastListItemType" xmlns:ns5="http://MREML2/schema/ProgramList"/>
  68. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns6:ProgramInfoType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramList.ProgramInfoType" xmlns:ns6="http://MREML2/schema/ProgramList"/>
  69. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns7:SignalSourceType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramList.SignalSourceType" xmlns:ns7="http://MREML2/schema/ProgramList"/>
  70. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns8:CommonRequestType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.CommonDataType.CommonRequestType" xmlns:ns8="http://MREML2/schema/CommonDataType"/>
  71. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns9:TapeInfoType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramList.TapeInfoType" xmlns:ns9="http://MREML2/schema/ProgramList"/>
  72. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns10:ImportProgramListResponseType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramListParameter.ImportProgramListResponseType" xmlns:ns10="http://MREML2/schema/ProgramListParameter"/>
  73. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns11:ExtendAttributeType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.CommonDataType.ExtendAttributeType" xmlns:ns11="http://MREML2/schema/CommonDataType"/>
  74. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns12:ChannelInfoType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.ProgramList.ChannelInfoType" xmlns:ns12="http://MREML2/schema/ProgramList"/>
  75. <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns13:CommonResponseType" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:MREML2.schema.CommonDataType.CommonResponseType" xmlns:ns13="http://MREML2/schema/CommonDataType"/>
  76. <ns1:arrayMapping innerType="ns14:ExtendAttributeType" languageSpecificType="java:MREML2.schema.CommonDataType.ExtendAttributeType[]" qname="ns14:ExtendAttributesType" xmlns:ns14="http://MREML2/schema/CommonDataType"/>
  77. </ns1:service>
  78.  
  79. <ns1:transport name="http">
  80. <ns1:requestFlow>
  81. <ns1:handler type="URLMapper"/>
  82. <ns1:handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
  83. </ns1:requestFlow>
  84. <ns1:parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler"/>
  85. <ns1:parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
  86. <ns1:parameter name="qs.list" value="org.apache.axis.transport.http.QSListHandler"/>
  87. <ns1:parameter name="qs.method" value="org.apache.axis.transport.http.QSMethodHandler"/>
  88. <ns1:parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler"/>
  89. <ns1:parameter name="qs.wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
  90. </ns1:transport>
  91. <ns1:transport name="local">
  92. <ns1:responseFlow>
  93. <ns1:handler type="LocalResponder"/>
  94. </ns1:responseFlow>
  95. </ns1:transport>
  96. </ns1:deployment>

server-config.wsdd

Web.xml中会相应生成相关代码:

  1. <servlet>
  2. <display-name>Apache-Axis Servlet</display-name>
  3. <servlet-name>AxisServlet</servlet-name>
  4. <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
  5. </servlet>
  6. <servlet-mapping>
  7. <servlet-name>AxisServlet</servlet-name>
  8. <url-pattern>/servlet/AxisServlet</url-pattern>
  9. </servlet-mapping>
  10. <servlet-mapping>
  11. <servlet-name>AxisServlet</servlet-name>
  12. <url-pattern>*.jws</url-pattern>
  13. </servlet-mapping>
  14. <servlet-mapping>
  15. <servlet-name>AxisServlet</servlet-name>
  16. <url-pattern>/services/*</url-pattern>
  17. </servlet-mapping>
  18. <servlet>
  19. <display-name>Axis Admin Servlet</display-name>
  20. <servlet-name>AdminServlet</servlet-name>
  21. <servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
  22. <load-on-startup>100</load-on-startup>
  23. </servlet>
  24. <servlet-mapping>
  25. <servlet-name>AdminServlet</servlet-name>
  26. <url-pattern>/servlet/AdminServlet</url-pattern>
  27. </servlet-mapping>

启动工程,访问http:ip:port/name/services,发布成功;

二、使用cxf集成springmvc发布Webservice:

工具:cxf-2.4.1 eclipse wsdl spingmvc

使用cxf中的wsdl2java命令生成java文件:

wsdl2java用法:

wsdl2java -p com -d src -all  aa.wsdl

-p  指定其wsdl的命名空间,也就是要生成代码的包名:

-d  指定要产生代码所在目录

-client 生成客户端测试web service的代码

-server 生成服务器启动web  service的代码

-impl 生成web service的实现代码

-ant  生成build.xml文件

-all 生成所有开始端点代码:types,service proxy,,service interface, server mainline, client mainline, implementation object, and an Ant build.xml file.

生成的java文件导入到工程中,添加spring依赖,依赖文件如下:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10.  
  11. http://www.apache.org/licenses/LICENSE-2.0
  12.  
  13. Unless required by applicable law or agreed to in writing,
  14. software distributed under the License is distributed on an
  15. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. KIND, either express or implied. See the License for the
  17. specific language governing permissions and limitations
  18. under the License.
  19. -->
  20. <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  21. xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
  22. <info
  23. organisation=""
  24. module="adagent"
  25. status="integration">
  26. </info>
  27. <configurations>
  28. <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
  29. <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
  30. <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
  31. <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
  32. <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
  33. <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
  34. <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
  35. <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
  36. <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
  37. <conf name="optional" visibility="public" description="contains all optional dependencies"/>
  38. </configurations>
  39. <dependencies>
  40. <!--spring-->
  41. <dependency org="org.springframework" name="spring-core" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  42. <dependency org="org.springframework" name="spring-beans" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  43. <dependency org="org.springframework" name="spring-web" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  44. <dependency org="org.springframework" name="spring-context" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  45. <dependency org="org.springframework" name="spring-context-support" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  46. <dependency org="org.springframework" name="spring-aop" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  47. <dependency org="org.springframework" name="spring-expression" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  48. <dependency org="org.springframework" name="spring-tx" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  49. <dependency org="org.springframework" name="spring-jms" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  50. <dependency org="org.springframework" name="spring-jdbc" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  51. <dependency org="org.springframework" name="spring-webmvc" rev="4.0.4.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  52. <dependency org="org.slf4j" name="slf4j-api" rev="1.7.7" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  53. <dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.7.7" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  54. <dependency org="org.slf4j" name="jul-to-slf4j" rev="1.7.7" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  55. <dependency org="org.slf4j" name="log4j-over-slf4j" rev="1.7.7" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  56. <dependency org="ch.qos.logback" name="logback-classic" rev="1.1.2" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  57. <dependency org="ch.qos.logback" name="logback-core" rev="1.1.2" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  58. <!--json序列化-->
  59. <dependency org="com.fasterxml.jackson.core" name="jackson-core" rev="2.3.1" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  60. <dependency org="com.fasterxml.jackson.core" name="jackson-annotations" rev="2.3.1" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  61. <dependency org="com.fasterxml.jackson.core" name="jackson-databind" rev="2.3.1" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  62. <!--HTTP-->
  63. <dependency org="org.aopalliance" name="com.springsource.org.aopalliance" rev="1.0.0" />
  64. <dependency org="org.springframework.data" name="spring-data-commons" rev="1.10.0.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  65. <dependency org="org.apache.httpcomponents" name="httpclient" rev="4.3.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  66. <dependency org="org.apache.httpcomponents" name="httpcore" rev="4.3.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  67. <dependency org="org.apache.httpcomponents" name="httpmime" rev="4.3.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  68. <dependency org="org.apache.ws.xmlschema" name="xmlschema-core" rev="2.1.0" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  69. <!--cxf-->
  70. <dependency org="org.apache.cxf" name="cxf-bundle" rev="2.7.11" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  71. <dependency org="org.apache.neethi" name="neethi" rev="3.0.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  72. <dependency org="org.apache.velocity" name="velocity" rev="1.7" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  73. <dependency org="org.apache.ws.xmlschema" name="xmlschema-core" rev="2.1.0" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  74. <dependency org="javax.xml.bind" name="jaxb-api" rev="2.2.4" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  75. <dependency org="javax.xml.soap" name="saaj-api" rev="1.3.5" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  76. <dependency org="com.sun.xml.bind" name="jaxb-xjc" rev="2.2.7" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  77. <dependency org="com.sun.xml.bind" name="jaxb-core" rev="2.2.7" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  78. <dependency org="com.sun.xml.messaging.saaj" name="saaj-impl" rev="1.3.23" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  79. <dependency org="org.codehaus.woodstox" name="woodstox-core-asl" rev="4.3.0" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  80. <dependency org="org.codehaus.woodstox" name="stax2-api" rev="3.1.4" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  81. <dependency org="org.jvnet.staxex" name="stax-ex" rev="1.7.7" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  82. <dependency org="org.codehaus.jettison" name="jettison" rev="1.3.5" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  83. <dependency org="wsdl4j" name="wsdl4j" rev="1.6.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  84.  
  85. <!-- axis相关内容 -->
  86. <dependency org="axis" name="axis" rev="1.4" conf="compile->compile(*),master(*);runtime->runtime(*)" />
  87. <dependency org="axis" name="axis-jaxrpc" rev="1.4" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false" />
  88. <dependency org="axis" name="axis-saaj" rev="1.4" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false" />
  89. <dependency org="axis" name="axis-wsdl4j" rev="1.5.1" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false" />
  90. <dependency org="commons-discovery" name="commons-discovery" rev="0.2" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false" />
  91.  
  92. <dependency org="com.google.code.gson" name="gson" rev="2.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  93. <dependency org="dom4j" name="dom4j" rev="1.6.1" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  94. <!--
  95. <dependency org="org.apache.axis" name="axis" rev="1.4" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  96. -->
  97. <dependency org="jaxen" name="jaxen" rev="1.1-beta-9" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  98. <dependency org="javax.validation" name="validation-api" rev="1.1.0.Final" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false" />
  99. <dependency org="javax.ws.rs" name="javax.ws.rs-api" rev="2.0-m10" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  100. <dependency org="org.springframework.data" name="spring-data-mongodb" rev="1.7.0.RELEASE" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  101. <dependency org="org.mongodb" name="mongo-java-driver" rev="3.0.0-rc1" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  102. <dependency org="org.apache.solr" name="solr-solrj" rev="5.1.0" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  103.  
  104. <dependency org="org.apache.commons" name="commons-vfs2" rev="2.0" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  105. <dependency org="commons-discovery" name="commons-discovery" rev="0.5" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  106. <dependency org="commons-logging" name="commons-logging" rev="1.2" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  107. <dependency org="javax.xml.rpc" name="javax.xml.rpc-api" rev="1.1" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/>
  108. </dependencies>
  109. </ivy-module>

ivy.xml

Web.xml文件添加代码:

  1. <servlet>
  2. <servlet-name>CXFService</servlet-name>
  3. <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
  4. <load-on-startup>1</load-on-startup>
  5. </servlet>
  6. <servlet-mapping>
  7. <servlet-name>CXFService</servlet-name>
  8. <url-pattern>/*</url-pattern>
  9. </servlet-mapping>

spring的beans文件添加如下代码:

  1. <bean id="WebServiceBean" class="org.tempuri.WebserviceSoapImpl"></bean>
  2.  
  3. <jaxws:server id="WebServiceSoap"
  4. serviceClass="org.tempuri.WebServiceSoap" address="/WebService.asmx">
  5. <jaxws:serviceBean>
  6. <ref bean="WebServiceBean"/>
  7. </jaxws:serviceBean>
  8. </jaxws:server>

以上可实现webservice的发布;

三、使用cxf发布restful接口:

添加代码:

  1. import javax.ws.rs.GET;
  2. import javax.ws.rs.Path;
  3. import javax.ws.rs.Produces;
  4. import javax.ws.rs.core.MediaType;
  5.  
  6. import org.slf4j.Logger;
  7. import org.slf4j.LoggerFactory;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.data.mongodb.core.MongoTemplate;
  10. import org.springframework.stereotype.Component;
  11.  
  12. @Path("/test")
  13. @Produces(MediaType.APPLICATION_JSON)
  14. @Component("cxfRestfulRS")
  15. public class CxfRestfulRS {
  16.  
  17. private static final Logger logger = LoggerFactory.getLogger(CxfRestfulRS.class);
  18.  
  19. @Autowired
  20. MongoTemplate mongoTemplate;
  21.  
  22. @GET
  23. @Path(value = "/check")
  24. public String check() {
  25. try {
  26. System.out.println("服务运行正常...");
  27. } catch (Throwable e) {
  28. logger.error(e.getMessage());
  29. logger.debug(e.getMessage(), e);
  30. }
  31. return "服务运行正常...";
  32. }
  33.  
  34. @Path(value = "/add")
  35. @GET
  36. public void add() {
  37. try {
  38. TestMo mo = new TestMo();
  39. mo.setId("1111");
  40. mo.setMessage("2222");
  41. mo.setName("3333");
  42. mongoTemplate.insert(mo);
  43.  
  44. } catch (Throwable e) {
  45. logger.error(e.getMessage());
  46. logger.debug(e.getMessage(), e);
  47. }
  48. }
  49. }

CxfRestfulRS.java

添加beans配置:

  1. <jaxrs:server id="webService" address="/">
  2. <!--输入拦截器设置-->
  3. <jaxrs:inInterceptors>
  4.  
  5. </jaxrs:inInterceptors>
  6.  
  7. <!--输出拦截器设置-->
  8. <jaxrs:outInterceptors>
  9.  
  10. </jaxrs:outInterceptors>
  11.  
  12. <!--serviceBeans:暴露的WebService服务类-->
  13. <jaxrs:serviceBeans>
  14. <ref bean="cxfRestfulRS"/>
  15. </jaxrs:serviceBeans>
  16.  
  17. <!--支持的协议-->
  18. <jaxrs:extensionMappings>
  19. <entry key="json" value="application/json"/>
  20. <entry key="xml" value="application/xml"/>
  21. </jaxrs:extensionMappings>
  22. </jaxrs:server>

beans.xml完整文件:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:util="http://www.springframework.org/schema/util"
  5. xmlns:p="http://www.springframework.org/schema/p"
  6. xmlns:aop="http://www.springframework.org/schema/aop"
  7. xmlns:tx="http://www.springframework.org/schema/tx"
  8. xmlns:mvc="http://www.springframework.org/schema/mvc"
  9. xmlns:context="http://www.springframework.org/schema/context"
  10. xmlns:jaxws="http://cxf.apache.org/jaxws"
  11. xmlns:jaxrs="http://cxf.apache.org/jaxrs"
  12. xmlns:mongo="http://www.springframework.org/schema/data/mongo"
  13. xsi:schemaLocation="
  14. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  15. http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
  16. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
  17. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
  18. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
  19. http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.5.xsd
  20. http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository-1.5.xsd
  21. http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
  22. http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
  23. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
  24.  
  25. <!-- 自动扫描 -->
  26. <context:annotation-config />
  27.  
  28. <mvc:annotation-driven />
  29.  
  30. <context:component-scan base-package="com.ad" />
  31.  
  32. <context:property-placeholder location="classpath:com/ad/mongodb.properties" />
  33. <!--
  34. <mongo:mongo id="mongo" host="${mongodb.host}" port="${mongodb.port}" />
  35. -->
  36. <mongo:mongo id="mongo" replica-set="${mongodb.replicaSet}" />
  37.  
  38. <mongo:db-factory id="mongoDbFactory" dbname="${mongodb.database}"
  39. mongo-ref="mongo" />
  40.  
  41. <!-- mongo模板操作对象 -->
  42. <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
  43. <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
  44. </bean>
  45.  
  46. <bean id="WebServiceBean" class="org.tempuri.WebserviceSoapImpl"></bean>
  47.  
  48. <jaxws:server id="WebServiceSoap"
  49. serviceClass="org.tempuri.WebServiceSoap" address="/WebService.asmx">
  50. <jaxws:serviceBean>
  51. <ref bean="WebServiceBean"/>
  52. </jaxws:serviceBean>
  53. </jaxws:server>
  54.  
  55. <jaxrs:server id="webService" address="/">
  56. <!--输入拦截器设置-->
  57. <jaxrs:inInterceptors>
  58.  
  59. </jaxrs:inInterceptors>
  60.  
  61. <!--输出拦截器设置-->
  62. <jaxrs:outInterceptors>
  63.  
  64. </jaxrs:outInterceptors>
  65.  
  66. <!--serviceBeans:暴露的WebService服务类-->
  67. <jaxrs:serviceBeans>
  68. <ref bean="cxfRestfulRS"/>
  69. </jaxrs:serviceBeans>
  70.  
  71. <!--支持的协议-->
  72. <jaxrs:extensionMappings>
  73. <entry key="json" value="application/json"/>
  74. <entry key="xml" value="application/xml"/>
  75. </jaxrs:extensionMappings>
  76. </jaxrs:server>
  77. </beans>

Web.xml完整文件:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  3. <display-name>ADAgent</display-name>
  4. <welcome-file-list>
  5. <welcome-file>index.html</welcome-file>
  6. </welcome-file-list>
  7. <context-param>
  8. <param-name>contextConfigLocation</param-name>
  9. <param-value>/WEB-INF/spring-beans.xml</param-value>
  10. </context-param>
  11. <context-param>
  12. <param-name>logConfigFile</param-name>
  13. <param-value>config/logback.xml</param-value>
  14. </context-param>
  15. <context-param>
  16. <param-name>propertiesFiles</param-name>
  17. <param-value>config/adagent.properties</param-value>
  18. </context-param>
  19. <listener>
  20. <listener-class>com.ad.main.SpringWebMain</listener-class>
  21. </listener>
  22. <!--
  23. <servlet>
  24. <servlet-name>springmvc</servlet-name>
  25. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  26. <init-param>
  27. <param-name>contextConfigLocation</param-name>
  28. <param-value>classpath:com/ad/beans.xml</param-value>
  29. </init-param>
  30. <load-on-startup>1</load-on-startup>
  31. </servlet>
  32. <servlet-mapping>
  33. <servlet-name>springmvc</servlet-name>
  34. <url-pattern>/</url-pattern>
  35. </servlet-mapping>
  36. -->
  37.  
  38. <servlet>
  39. <servlet-name>CXFService</servlet-name>
  40. <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
  41. <load-on-startup>1</load-on-startup>
  42. </servlet>
  43. <servlet-mapping>
  44. <servlet-name>CXFService</servlet-name>
  45. <url-pattern>/*</url-pattern>
  46. </servlet-mapping>
  47.  
  48. <servlet>
  49. <display-name>Apache-Axis Servlet</display-name>
  50. <servlet-name>AxisServlet</servlet-name>
  51. <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
  52. </servlet>
  53. <servlet-mapping>
  54. <servlet-name>AxisServlet</servlet-name>
  55. <url-pattern>/servlet/AxisServlet</url-pattern>
  56. </servlet-mapping>
  57. <servlet-mapping>
  58. <servlet-name>AxisServlet</servlet-name>
  59. <url-pattern>*.jws</url-pattern>
  60. </servlet-mapping>
  61. <servlet-mapping>
  62. <servlet-name>AxisServlet</servlet-name>
  63. <url-pattern>/services/*</url-pattern>
  64. </servlet-mapping>
  65. <servlet>
  66. <display-name>Axis Admin Servlet</display-name>
  67. <servlet-name>AdminServlet</servlet-name>
  68. <servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
  69. <load-on-startup>100</load-on-startup>
  70. </servlet>
  71. <servlet-mapping>
  72. <servlet-name>AdminServlet</servlet-name>
  73. <url-pattern>/servlet/AdminServlet</url-pattern>
  74. </servlet-mapping>
  75. </web-app>
  1. package com.ad.main;
  2.  
  3. import java.io.File;
  4. import java.io.FileNotFoundException;
  5. import java.io.FileReader;
  6. import java.io.IOException;
  7. import java.util.Enumeration;
  8. import java.util.Properties;
  9.  
  10. import javax.servlet.ServletContext;
  11. import javax.servlet.ServletContextEvent;
  12.  
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.context.ApplicationContext;
  16. import org.springframework.util.StringUtils;
  17. import org.springframework.web.context.ContextLoaderListener;
  18.  
  19. import com.LoggerConfigurator;
  20.  
  21. public class SpringWebMain extends ContextLoaderListener {
  22.  
  23. protected static final String INIT_PARAM_HOMEDIR = "homeDirectory";
  24.  
  25. protected static final String INIT_PARAM_LOGCONFIGFILE = "logConfigFile";
  26.  
  27. protected static final String INIT_PARAM_PROPERTIESFILES = "propertiesFiles";
  28.  
  29. protected static final String SYS_PPT_APPHOME = "app.home";
  30.  
  31. protected static final Logger logger = LoggerFactory
  32. .getLogger(SpringWebMain.class);
  33.  
  34. public static <T> T getBean(Class<T> requiredType) {
  35. ApplicationContext ac = ContextLoaderListener
  36. .getCurrentWebApplicationContext();
  37. if (ac != null) {
  38. return ac.getBean(requiredType);
  39. } else {
  40. throw new org.springframework.context.ApplicationContextException(
  41. "ApplicationContext has not been set.");
  42. }
  43. }
  44.  
  45. public static <T> T getBean(String name, Class<T> requiredType) {
  46. ApplicationContext ac = ContextLoaderListener
  47. .getCurrentWebApplicationContext();
  48. if (ac != null) {
  49. return ac.getBean(name, requiredType);
  50. } else {
  51. throw new org.springframework.context.ApplicationContextException(
  52. "ApplicationContext has not been set.");
  53. }
  54. }
  55.  
  56. @Override
  57. public void contextDestroyed(ServletContextEvent event) {
  58. org.slf4j.bridge.SLF4JBridgeHandler.uninstall();
  59. super.contextDestroyed(event);
  60. }
  61.  
  62. @Override
  63. public void contextInitialized(ServletContextEvent event) {
  64. ServletContext sc = event.getServletContext();
  65. initialize(sc);
  66. super.contextInitialized(event);
  67. }
  68.  
  69. protected String getLogbackConfigFileName() {
  70. return null;
  71. }
  72.  
  73. protected String[] getPropertiesFileNames() {
  74. return new String[] {};
  75. }
  76.  
  77. private String getLogbackConfigFileName(ServletContext servletContext) {
  78. String cfn = servletContext.getInitParameter(INIT_PARAM_LOGCONFIGFILE);
  79. if (StringUtils.hasLength(cfn)) {
  80. return cfn;
  81. } else {
  82. return this.getLogbackConfigFileName();
  83. }
  84. }
  85.  
  86. private String[] getPropertiesFileNames(ServletContext servletContext) {
  87. String ppfs = servletContext
  88. .getInitParameter(INIT_PARAM_PROPERTIESFILES);
  89. if (StringUtils.hasLength(ppfs)) {
  90. return ppfs.split(";");
  91. } else {
  92. return this.getPropertiesFileNames();
  93. }
  94. }
  95.  
  96. protected void initialize(ServletContext servletContext) {
  97. String appname = servletContext.getServletContextName();
  98. String homedir_ppt_name = appname + ".home";
  99. String homedir = servletContext.getInitParameter(INIT_PARAM_HOMEDIR);
  100. if (!StringUtils.hasText(homedir)) {
  101. homedir = System.getProperty(homedir_ppt_name);
  102. }
  103. if (!StringUtils.hasText(homedir)) {
  104. homedir = System.getenv(appname + "_home");
  105. }
  106. if (!StringUtils.hasText(homedir)) {
  107. homedir = ".";
  108. logger.warn("未找到" + homedir_ppt_name + ",请正确配置,否则系统将无法正常运行!");
  109. logger.warn("暂时将" + homedir_ppt_name + "的值设置为当前目录!");
  110. }
  111. // 强制加入System,以便logback等其他配置使用
  112. System.setProperty(homedir_ppt_name, homedir);
  113. System.setProperty(SYS_PPT_APPHOME, homedir);
  114.  
  115. // 日志处理
  116. System.setProperty("org.apache.cxf.Logger",
  117. "org.apache.cxf.common.logging.Slf4jLogger");
  118. if (!org.slf4j.bridge.SLF4JBridgeHandler.isInstalled()) {
  119. org.slf4j.bridge.SLF4JBridgeHandler.install();
  120. }
  121. File logcf = new File(homedir, getLogbackConfigFileName(servletContext));
  122. logger.info("加载日志配置文件:{}", logcf.getAbsolutePath());
  123. LoggerConfigurator.config(logcf.getAbsolutePath());
  124.  
  125. // 加载配置文件
  126. for (String str : getPropertiesFileNames(servletContext)) {
  127. if (StringUtils.hasLength(str)) {
  128. loadProperties(homedir + "/" + str);
  129. }
  130. }
  131. }
  132.  
  133. private void loadProperties(String filename) {
  134. File file = new File(filename);
  135. if (!file.exists()) {
  136. logger.warn("未找到文件:" + filename + ",请正确配置,否则系统将无法正常运行!");
  137. return;
  138. }
  139. logger.info("加载配置文件:{}", file.getAbsolutePath());
  140. Properties ppts = new Properties();
  141. try {
  142. ppts.load(new FileReader(file));
  143. } catch (FileNotFoundException e) {
  144. logger.error("未找到文件:" + filename + ",请正确配置,否则系统将无法正常运行!");
  145. } catch (IOException e) {
  146. logger.error("加载文件:" + filename + ",请正确配置,否则系统将无法正常运行!");
  147. }
  148. // 插入到System.Properties
  149. for (Enumeration<?> e = ppts.propertyNames(); e.hasMoreElements();) {
  150. String key = (String) e.nextElement();
  151. System.setProperty(key, ppts.getProperty(key));
  152. }
  153. }
  154. }

SpringWebMain

  1. package com;
  2.  
  3. import org.slf4j.LoggerFactory;
  4.  
  5. import ch.qos.logback.classic.LoggerContext;
  6. import ch.qos.logback.classic.joran.JoranConfigurator;
  7. import ch.qos.logback.core.joran.spi.JoranException;
  8. import ch.qos.logback.core.util.StatusPrinter;
  9.  
  10. public class LoggerConfigurator {
  11.  
  12. public static void config(String logbackCfg) {
  13. LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
  14. try {
  15. JoranConfigurator configurator = new JoranConfigurator();
  16. configurator.setContext(lc);
  17. // the context was probably already configured by default
  18. // configuration rules
  19. lc.reset();
  20. configurator.doConfigure(logbackCfg);
  21. } catch (JoranException je) {
  22. // StatusPrinter will handle this
  23. }
  24. StatusPrinter.printIfErrorsOccured(lc);
  25. }
  26. }

LoggerConfigurator.java

axis和cxf集成Springmvc的使用的更多相关文章

  1. WebService流行框架之Axis和CXF

    转自:http://www.cnblogs.com/snake-hand/archive/2013/06/09/3129915.html 前言 上节课我们对WebService进行了简单的介绍,对于其 ...

  2. CXF集成Spring实现webservice的发布与请求

    CXF集成Spring实现webservice的发布(服务端) 目录结构: 主要代码: package com.cxf.spring.pojo; public class User { int id ...

  3. Quartz集成springMVC 的方案二(持久化任务、集群和分布式)

    Quartz是一个开放源码项目,专注于任务调度器,提供了极为广泛的特性如持久化任务,集群和分布式任务等. Quartz核心是调度器,还采用多线程管理. 1.持久化任务:当应用程序停止运行时,所有调度信 ...

  4. Quartz集成springMVC 的方案一

    Quartz是一个开放源码项目,专注于任务调度器. springMVC 具体的搭建框架就不具体说明,接下来直接描述把Quartz集成到springMVC 框架中. 步骤: 1.引入所需要的jar包 2 ...

  5. tinyweb集成springmvc 的一种可行方式

    最近tiny项目中集成了springmvc,而且使用的tiny的版本比较低,所以整合起来官网给的前两种方式都行不通. 而且有个tiny整合springmvc的maven依赖都下载不了.所以只有使用第三 ...

  6. 一个CXF集成SPRING的WEBSERVICE完整实例

    1 首先准备以下JAR包 activation.jar commons-logging-1.1.1.jar cxf-2.5.6.jar jaxb-api-2.2.1.jar jaxb-impl-2.1 ...

  7. (第04节)集成SpringMVC框架

    在上一节的基础上集成spring_mvc 首先添加依赖文件 <properties> <javax.servlet.version>4.0.0</javax.servle ...

  8. 集成SpringMVC, Spring, Mybatis环境

    web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app version=" ...

  9. IntelliJ IDEA 使用maven 集成SpringMVC+Hibernate

    准备工作: 安装idea intellij 安装jdk1.8,配好环境变量 安装tomcat 7 准备工作完成之后,就开始创建项目了 创建项目 1.File–>new project–>选 ...

随机推荐

  1. 新的表格展示利器 Bootstrap Table Ⅱ

        上一篇文章介绍了Bootstrap Table的基本知识点和应用,本文针对上一篇文章中未解决的文件导出问题进行分析,同时介绍BootStrap Table的扩展功能,当行表格数据修改. 1.B ...

  2. 解析:type t_string is table of varchar2(32767) index by binary_integer

    @ 理解一: table 相当于是数组,这里定义了一个数组类型t_string; INDEX BY BINARY_INTEGER这里是定义数组下标是整数,因为ORACLE中下标可以是字符串. VARC ...

  3. RPC框架实现思路浅析

    第一部分,设计分析 远程调用要解决的主要问题: 1,序列化 : 如何将对象转化为二进制数据进行传输,如何将二进制数据转化对象 2,数据的传输(协议,第三方框架) 3,服务的注册/发现,单点故障,分布式 ...

  4. Begin the new life as a coder

    今天刚刚开通博客园的博客频道,这里将成为自我成长点滴记录的土壤!从今天开始,从这篇博文开始,我将分享自己从一个fresher开始的成长经历.原与广大仁人志士共同在程序中共享快乐!我真是太高兴了 :D

  5. ios 初体验<UIButton 控件>

    1.创建UIButton 跟其他方式不同,不是直接alloc,init 创建 用工厂化方式创建 UIButton *sureBtn = [UIButton buttonWithType:UIButto ...

  6. WPF--鼠标右键菜单中的Command命令实现

    一个功能,在ListView中的ListBoxItem控件上实现右键菜单关闭选项,将该ListBoxItem从ListView中删除. 利用 RoutedCommand类创建Command命令,MSD ...

  7. GUI线程 :打字母游戏

    代码: /** * */ package com.niit.syntronized; import java.awt.Color; import java.awt.FlowLayout; import ...

  8. 个人作业3——个人总结(Alphe)

    小结: 1.软件工程的第一阶段终于结束了,说实话,每个人的课程都很紧张,在这么紧张的时期我们都每周抽出一些时间来开个小会总结或者计划软件工程的相关任何非常难得,大家的态度都诚恳认真,我亦是如此,只是我 ...

  9. 团队作业3-需求改进&原型设计

    选题:实验室报修系统 实验室设备经常会发生这样或那样的故障,靠值班人员登记设备故障现象,维护人员查看故障记录,进行维修,然后登记维修过程与内容,以备日后复查,用这种方式进行设备运营管理,它仅仅起到一个 ...

  10. 201521123050 《Java程序设计》第6周学习总结

    1. 本周学习总结 2. 书面作业 1.clone方法 1.1 Object对象中的clone方法是被protected修饰,在自定义的类中覆盖clone方法时需要注意什么? 答:(1)x.clone ...