代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
Java
】
SSH2集成下 搭建WebService
作者:
你不懂的神__经
/ 发布于
2015/7/9
/
605
public interface LoginWebService { String webLogin(String loginName,String password); public class LoginWebServiceImpl extends BaseCodServiceImpl implements LoginWebService { private UserService userService ; private GoodsService goodsService ; public class BaseCodServiceImpl extends BaseServiceImpl { protected AreaDAO areaDAO ; protected CarInfoDAO carInfoDAO ; protected CarKeepDAO carKeepDAO ; public class BaseServiceImpl{ protected AuthorityDAO authorityDAO ; protected CompanyDAO companyDAO ; applicationContext-webservice-common.xml <?xml version="1.0" encoding= "UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cache="http://www.springframework.org/schema/cache" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd"> <aop:config> <aop:pointcut id= "wsServiceManagerMethod" expression="execution(* com.xulin.webservice.impl.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="wsServiceManagerMethod" /> </aop:config> </beans> xfire-servlet.xml <?xml version="1.0" encoding= "UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" > <beans> <bean id= "crossWebService" class="com.xulin.webservice.impl.CrossWebServiceImpl" > <property name="orderService" ref="orderService"></ property> <property name="userService" ref="userService"></ property> </bean> <bean id= "appWebService" class="com.xulin.webservice.impl.AppWebServiceImpl" > <property name="orderService" ref="orderService"></ property> <property name="userService" ref="userService"></ property> <property name="systemInfoService" ref="systemInfoService" ></property> <property name="costDetailService" ref="costDetailService" ></property> <property name="companyService" ref="companyService" ></property> <property name="roleService" ref="roleService"></ property> <property name="userRoleService" ref="userRoleService" ></property> <property name="roleAuthorityService" ref="roleAuthorityService" ></property> <property name="departmentService" ref="departmentService" ></property> <property name="clientService" ref="clientService" ></property> <property name="logService" ref="logService"></ property> <property name="workFlowAuditService" ref="workFlowAuditService" ></property> <property name="messageService" ref="messageService" ></property> <property name="areaService" ref="areaService"></ property> <property name="sendcarService" ref="sendcarService" ></property> <property name="goodsService" ref="goodsService"></ property> <property name="outboundService" ref="outboundService" ></property> </bean> <bean id= "loginWebService" class="com.xulin.webservice.impl.LoginWebServiceImpl" > <property name="userService" ref="userService"></ property> <property name="goodsService" ref="goodsService"></ property> <property name="warehouseService" ref="warehouseService" ></property> <property name="goodsAllocationService" ref="goodsAllocationService" ></property> <property name="systemInfoService" ref="systemInfoService" ></property> <property name="outboundService" ref="outboundService" ></property> <property name="inboundService" ref="inboundService" ></property> <property name="inventoryService" ref="inventoryService" ></property> <property name="goodsTypeService" ref="goodsTypeService" ></property> <property name="goodsBrandService" ref="goodsBrandService" ></property> <property name="carInfoService" ref="carInfoService" ></property> <property name="orderService" ref="orderService"></ property> <property name="interceptRulesService" ref="interceptRulesService" ></property> <property name="workFlowService" ref="workFlowService" ></property> <property name="planService" ref="planService"></ property> <property name="workFlowAuditService" ref="workFlowAuditService" ></property> <property name="messageService" ref="messageService" ></property> <property name="goodsDetailService" ref="goodsDetailService" ></property> <property name="logService" ref="logService"></ property> <property name="costProjectDetailService" ref="costProjectDetailService" ></property> <property name="clientService" ref="clientService" ></property> <property name="areaService" ref="areaService"></ property> <property name="importRecordService" ref="importRecordService" ></property> <property name="endLinkManService" ref="endLinkManService" ></property> <property name="goodsSupplierService" ref="goodsSupplierService" ></property> <property name="orderMergeService" ref="orderMergeService" ></property> <property name="orderContainerService" ref="orderContainerService" ></property> </bean> <!-- 引入XFire预配置信息 --> <import resource="classpath:org/codehaus/xfire/spring/xfire.xml" /> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" > <property name="urlMap" > <map> <entry key="/CrossWebService.ws" > <ref bean="CrossWebService" /> </entry> <entry key="/LoginWebService.ws" > <ref bean="LoginWebService" /> </entry> <entry key="/AppWebService.ws" > <ref bean="AppWebService" /> </entry> </map> </property> </bean> <!-- 使用XFire导出器 --> <bean id= "baseWebService" class="org.codehaus.xfire.spring.remoting.XFireExporter" lazy-init="false" abstract= "true"> <!-- 引用xfire.xml中定义的工厂 --> <property name="serviceFactory" ref="xfire.serviceFactory" /> <!-- 引用xfire.xml中的 xfire实例 --> <property name="xfire" ref="xfire" /> </bean> <bean id= "CrossWebService" parent ="baseWebService"> <!-- 业务服务bean --> <property name="serviceBean" ref="crossWebService" /> <!-- 业务服务bean的窄接口类 --> <property name="serviceClass" value="com.xulin.webservice.CrossWebService" /> </bean> <bean id= "LoginWebService" parent ="baseWebService"> <!-- 业务服务bean --> <property name="serviceBean" ref="loginWebService" /> <!-- 业务服务bean的窄接口类 --> <property name="serviceClass" value="com.xulin.webservice.LoginWebService" /> </bean> <bean id= "AppWebService" parent ="baseWebService"> <!-- 业务服务bean --> <property name="serviceBean" ref="appWebService" /> <!-- 业务服务bean的窄接口类 --> <property name="serviceClass" value="com.xulin.webservice.AppWebService" /> </bean> </beans> web.xml <!-- begin XFire 配置 --> <servlet > <servlet-name >xfire</ servlet-name> <servlet-class > org.springframework.web.servlet.DispatcherServlet </servlet-class > </servlet > <servlet-mapping > <servlet-name >xfire</ servlet-name> <url-pattern >*.ws</url-pattern > </servlet-mapping > <servlet > <!-- 配合Spring容器中XFire一起工作的 Servlet--> <servlet-name >xfireServlet</ servlet-name> <servlet-class > org.codehaus.xfire.spring.XFireSpringServlet </servlet-class > </servlet > <servlet-mapping > <servlet-name >xfireServlet</ servlet-name> <!-- 在这个URI下开放Web Service服务 --> <url-pattern >/webservice/* </url-pattern> </servlet-mapping > <!-- end XFire 配置 --> --- 完整代码 <?xml version="1.0" encoding= "UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" > <error-page> <error-code> 500</error-code > <location> /err500.jsp</location > </error-page> <error-page> <error-code> 404</error-code > <location> /err404.jsp</location > </error-page> <context-param > <param-name> contextConfigLocation</param-name > <param-value> classpath:applicationContext-*.xml,/WEB-INF/xfire-servlet.xml </param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <!-- 自定义监听器 --> <listener> <listener-class> com.djzhou.gmms.util.listener.StaticListener</listener-class > </listener> <listener> <listener-class> com.xulin.fycod.listener.OrderImportListener</listener-class > </listener> <listener> <listener-class> com.xulin.fycod.listener.OrderImportFromServletListener </listener-class> </listener> <!-- 管理延迟加载 --> <filter> <filter-name> hibernateFilter</filter-name > <filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter </filter-class> </filter > <filter-mapping > <filter-name> hibernateFilter</filter-name > <url-pattern> /*</ url-pattern> </filter-mapping > <filter > <filter-name> GzipFilter</filter-name > <filter-class> net.sf.ehcache.constructs.web.filter.GzipFilter</filter-class > </filter > <filter-mapping > <filter-name> GzipFilter</filter-name > <url-pattern> *.*</url-pattern > </filter-mapping > <filter-mapping > <filter-name> GzipFilter</filter-name > <url-pattern> /*Servlet </url-pattern> </filter-mapping > <!-- 加载struts2 --> <display-name> Struts Blank</display-name > <filter > <filter-name> struts2</filter-name > <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter > <filter-mapping > <filter-name> struts2</filter-name > <url-pattern> *.action</url-pattern > </filter-mapping > <context-param > <param-name >log4jConfigLocation</ param-name> <param-value >/WEB-INF/classes/log4j.properties</ param-value> </context-param > <listener > <listener-class > org.springframework.web.util.Log4jConfigListener </listener-class > </listener > <servlet > <description> 文件上传Serlvet</description> <display-name> 文件上传Serlvet</display-name> <servlet-name> FileUploadServlet</servlet-name > <servlet-class> com.djzhou.gmms.util.servlet.FileUploadServlet</servlet-class > <init-param> <param-name> fileSizeLimit</param-name > <param-value> 50</ param-value> </init-param> </servlet> <servlet> <description> 文件删除Servlet</description> <display-name> 文件删除Servlet</display-name> <servlet-name> DeleteFileServlet</servlet-name > <servlet-class> com.djzhou.gmms.util.servlet.DeleteFileServlet</servlet-class > </servlet> <servlet > <description >验证码</ description> <display-name >验证码</ display-name> <servlet-name >ImageServlet</ servlet-name> <servlet-class> com.djzhou.gmms.util.servlet.ImageServlet</servlet-class > </servlet > <servlet-mapping> <servlet-name> FileUploadServlet</servlet-name > <url-pattern> /FileUploadServlet</url-pattern > </servlet-mapping> <servlet-mapping> <servlet-name> DeleteFileServlet</servlet-name > <url-pattern> /DeleteFileServlet</url-pattern > </servlet-mapping> <servlet-mapping > <servlet-name >ImageServlet</ servlet-name> <url-pattern >/ImageServlet</ url-pattern> </servlet-mapping > <servlet > <servlet-name> OrderServlet</servlet-name > <servlet-class> com.xulin.fycod.listener.OrderServlet</servlet-class > </servlet > <servlet-mapping > <servlet-name> OrderServlet</servlet-name > <url-pattern> /OrderServlet</url-pattern > </servlet-mapping > <!-- begin XFire 配置 --> <servlet > <servlet-name >xfire</ servlet-name> <servlet-class > org.springframework.web.servlet.DispatcherServlet </servlet-class > </servlet > <servlet-mapping > <servlet-name >xfire</ servlet-name> <url-pattern >*.ws</url-pattern > </servlet-mapping > <servlet > <!-- 配合Spring容器中XFire一起工作的 Servlet--> <servlet-name >xfireServlet</ servlet-name> <servlet-class > org.codehaus.xfire.spring.XFireSpringServlet </servlet-class > </servlet > <servlet-mapping > <servlet-name >xfireServlet</ servlet-name> <!-- 在这个URI下开放Web Service服务 --> <url-pattern >/webservice/* </url-pattern> </servlet-mapping > <!-- end XFire 配置 --> <mime-mapping > <extension> manifest</extension > <mime-type> text/cache-manifest</mime-type > </mime-mapping> <jsp-config > <taglib> <taglib-uri> /gmms-tags </taglib-uri> <taglib-location> /WEB-INF/gmms-tags.tld </taglib-location> </taglib> <taglib> <taglib-uri> /elf-tags</taglib-uri > <taglib-location> /WEB-INF/elfuns-tags.tld </taglib-location> </taglib> </jsp-config > <session-config > <session-timeout> 0</ session-timeout> </session-config > <welcome-file-list > <welcome-file >default.jsp</ welcome-file> </welcome-file-list > </web-app > 测试用的java类 Start.java package com.xulin.webservice.run; import java.net.URL; import java.util.Date; import org.codehaus.xfire.client.Client; import com.djzhou.util.MD5; public class Start { public static void main(String[] args) throws Exception { Client client = new Client( new URL("http://23.12.123.12:3111/sjjj/LoginWebService.ws?wsdl" )); // Object[] result = client.invoke("addGoods", new Object[]{"33333" ,"管理员" ,MD5.toMD5( "123456")}); // */ Date date1= new Date(); Date date2= new Date(); //System.out.println(result[0]); System. out.println("调用结果\n" +result[0].toString()); try { //毫秒ms long diff = date2.getTime() - date1.getTime(); System. out.println("两个时间相差:" +diff+ " 毫秒."); } catch (Exception e) { e.printStackTrace(); } client.close(); } }
试试其它关键字
WebService
SSH2
同语言下
.
List 切割成几份 工具类
.
一行一行读取txt的内容
.
Java PDF转换成图片并输出给前台展示
.
java 多线程框架
.
double类型如果小数点后为零则显示整数否则保留两位小
.
将图片转换为Base64字符串公共类抽取
.
sqlParser 处理SQL(增删改查) 替换schema 用于多租户
.
JAVA 月份中的第几周处理 1-7属于第一周 依次类推 29-
.
java计算两个经纬度之间的距离
.
输入时间参数计算年龄
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
你不懂的神__经
贡献的其它代码
(
2
)
.
SSH2集成下 搭建WebService
.
soap 调用WebService
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3