webServices 执行流程,(我是菜鸟,我怕谁,仅代表个人理解,欢迎各位大神们指导,不和您的胃口,请默默离开!!)

webServices 执行流程,(我是菜鸟,我怕谁,仅代表个人理解,欢迎各位大神们指导,不和您的胃口,请默默离开!!)_第1张图片

二、上图仅仅代表个人理解,下面以代码方式解释一下。

(1) strtus.xml

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
        "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
    <!-- 功能:维护工具 lotus  开发者:wg  15-09 -->
    <package name="/msp/invQryOrg" extends="default" namespace="/msp/invQryOrg">
         <action name="init" class="lotusOrgAction" method="init">
            <result name="init">/msp/pages/org/msLotusQryList.jsp</result>
        </action>
        <action name="query" class="lotusOrgAction" method="query">
            <result name="list">/msp/pages/org/msLotusQryList.jsp</result>
        </action>
        <action name="detail" class="lotusOrgAction" method="detail">
            <result name="success">/msp/pages/org/slLotusOrgDetail.jsp</result>
        </action>
        <action name="edit" class="lotusOrgAction" method="edit">
            <result name="success">/msp/pages/org/slLotusOrgEditList.jsp</result>
        </action>
        <action name="update" class="lotusOrgAction" method="update">
            <result name="success">/msp/pages/org/slLotusOrgEditList.jsp</result>
        </action>
        <action name="delete" class="lotusOrgAction" method="delete">
            <result name="success">query.hlt</result>
        </action>
         <action name="qryhistory" class="lotusOrgAction" method="qryhistory">
            <result name="list">/msp/pages/org/lotusOrgHistoryDetail.jsp</result>
        </action>
        <action name="initsave" class="lotusOrgAction" method="initsave">
            <result name="init">/msp/pages/org/slLotusInputList.jsp</result>
        </action>
        <action name="save" class="lotusOrgAction" method="save">
            <result name="success">/msp/pages/org/slLotusInputList.jsp</result>
        </action>
     </package>
</struts>

(2)spring.xml

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       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"
       default-lazy-init="true">
    <description>运维工具配置</description>
    <!-- 功能 LotusManager 开发者:wg  时间:2015-8-26 -->
    <bean id="lotusOrgManager" class="com.holytax.eipp.msp.qorg.service.LotusOrgManager" parent="manager">
    </bean>    
    <!-- 功能 报表Manager 开发者:wg  时间:2015-8-26 -->
    <bean id="lotusOrgManagerImpl" class="com.holytax.eipp.msp.qorg.service.LotusOrgManagerImpl" parent="manager">
    </bean>    
     <!-- 功能:LotusAction 开发者:wg  时间:2015-8-26-->
    <bean id="lotusOrgAction" class="com.holytax.eipp.msp.qorg.action.LotusOrgAction" scope="prototype">
        <!-- <property name="invoiceForManager" ref="invoiceForManager"/> -->
        <property name="wsCfg" ref="propWsCfg"/>
    </bean>
</beans>

(3)springServer.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding" /> 

    <bean id="jaxws-and-aegis-service-factory" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">   
        <property name="dataBinding" ref="aegisBean" />
    </bean>
    <!--目的:对于lotus的webservice服务器端配置     wg  时间:2012-09-11    -->
    <jaxws:server id="lotusOrgManager" serviceClass="com.holytax.eipp.msp.qorg.service.LotusOrgManager" address="/LotusOrgManager"><!--接口地址-->
        <jaxws:serviceBean>
            <ref bean="lotusOrgManagerImpl"/><!--接口方法的实现-->
        </jaxws:serviceBean>
        <jaxws:inInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
            <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />

            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
                <constructor-arg>
                    <map> 
                        <entry key="action" value="UsernameToken" />
                        <entry key="passwordType" value="PasswordText" />
                        <entry key="user" value="cxfServer" />
                        <entry key="passwordCallbackRef">
                            <ref bean="serverPasswordCallback" />
                        </entry>
                   </map>
               </constructor-arg>
           </bean>
           
        </jaxws:inInterceptors> 
        <jaxws:outInterceptors> 
            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/> 
        </jaxws:outInterceptors> 
        <jaxws:inFaultInterceptors> 
            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/> 
        </jaxws:inFaultInterceptors> 
        <jaxws:outFaultInterceptors> 
            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
        </jaxws:outFaultInterceptors>
    </jaxws:server>    
</beans>

(4)Action.java

package com.holytax.eipp.msp.qorg.action;

  
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.ws.security.WSConstants;
import org.apache.ws.security.handler.WSHandlerConstants;

import com.holytax.base.action.BaseAction;
import com.holytax.base.service.Page;
import com.holytax.base.util.Constants;
import com.holytax.base.util.StringUtil;
import com.holytax.eipp.msp.qorg.entity.TAcOrgdataBackup;
import com.holytax.eipp.msp.qorg.entity.TLotusAcOrg;
import com.holytax.eipp.msp.qorg.model.LotusOrgModel;
import com.holytax.eipp.msp.qorg.service.LotusOrgManager;
import com.holytax.eipp.webservice.cfg.IWsCfg;
import com.holytax.eipp.webservice.model.WsModel;
import com.holytax.eipp.webservice.security.ClientPasswordCallback;

public class LotusOrgAction extends BaseAction<TLotusAcOrg>{
    
    
    /**
     * 
     */
    private static final long serialVersionUID = -3501266082603574394L;
    private LotusOrgModel orgModel = new LotusOrgModel();
    private TLotusAcOrg entity=new TLotusAcOrg();
    private LotusOrgManager lotusOrgManager;
    //private Page<InvcoiceInforModel> page = new Page<InvcoiceInforModel>(Constants.PAGESIZE);
    private IWsCfg wsCfg;
    private Page<Map<String, Object>> page = new Page<Map<String, Object>>(
            Constants.PAGESIZE);
    private String[] _chk;//记录选中数组
    private TAcOrgdataBackup lotusentity =new TAcOrgdataBackup();//莲花备份实体
    private String loginUser;private Long parentid;
    private Long orgid;
    @Override
    protected void prepareModel() throws Exception {
        WsModel wsModel = wsCfg.getWsModel("holylotus");
        LotusOrgManager lotusOrgManager = getholyVatManager(wsModel.getUrl());
        if(entity.getOrgid()!=null){
            entity=lotusOrgManager.findInvById(entity.getOrgid());
        }
        
    }
    /**
     * 初始化方法
     * @return
     */
    public String init(){
        return INIT;
    }
    /**
     * 初始化方法
     * @return
     */
    public String initsave(){
        orgModel.setCode("holylotus");
        //String company = invModel.getCompany();
        String code = orgModel.getCode();
        if (StringUtil.isEmpty(code)) {
            addActionMessage("请选择公司");
        }
        if (wsCfg == null) {
            addActionMessage("未加载配置");
        }
        logger.info("使用ws配置:" + wsCfg.getClass().getName());
        WsModel model = wsCfg.getWsModel(code);
        if (model == null) {
            addActionMessage("未找到" + code + "对应的配置信息");
        }
        LotusOrgManager lotusOrgManager = getholyVatManager(model.getUrl());
        entity.setParentid(entity.getParentid());
        return INIT;
    }
    /**
     * 新增机构
     * @return
     */
    public String save(){
        orgModel.setCode("holylotus");
        //String company = invModel.getCompany();
        String code = orgModel.getCode();
        if (StringUtil.isEmpty(code)) {
            addActionMessage("请选择公司");
        }
        if (wsCfg == null) {
            addActionMessage("未加载配置");
        }
        logger.info("使用ws配置:" + wsCfg.getClass().getName());
        WsModel model = wsCfg.getWsModel(code);
        if (model == null) {
            addActionMessage("未找到" + code + "对应的配置信息");
        }
        LotusOrgManager lotusOrgManager = getholyVatManager(model.getUrl());
                try {
                    loginUser=(String) getSession().getAttribute(Constants.LOGIN_NAME);
                    entity.setCreateBy(loginUser);
                    entity.setCreateTime(new Date());
                    lotusOrgManager.save(entity);
                    addActionMessage("机构信息保存成功!!");
                    entity.setOrgname(null);
                    entity.setOrgcode(null);
                    entity.setTaxname(null);
                    entity.setTaxno(null);
                    entity.setLinkman(null);
                    entity.setPhone(null);
                    entity.setAddress(null);
                    entity.setEmail(null);
                    entity.setPostcode(null);
                    entity.setBank(null);
                    entity.setAccount(null);
                    entity.setTreelevel(null);
                    entity.setTreelayer(null);
                    entity.setRemark(null);
                } catch (Exception e) {
                    addActionMessage("机构信息保存失败!!");
                    entity.setOrgname(null);
                    entity.setOrgcode(null);
                    entity.setTaxname(null);
                    entity.setTaxno(null);
                    entity.setLinkman(null);
                    entity.setPhone(null);
                    entity.setAddress(null);
                    entity.setEmail(null);
                    entity.setPostcode(null);
                    entity.setBank(null);
                    entity.setAccount(null);
                    entity.setTreelevel(null);
                    entity.setTreelayer(null);
                    entity.setRemark(null);
                    e.printStackTrace();
                }
        return SUCCESS;
    }
    /**
     *lotus org数据查询
     * @return
     * @throws Exception
     */
    @SuppressWarnings("rawtypes")
    public String query ()throws Exception{
            orgModel.setCode("holylotus");
            String code = orgModel.getCode();
            if (StringUtil.isEmpty(code)) {
                addActionMessage("请选择公司");
            }
            if (wsCfg == null) {
                addActionMessage("未加载配置");
            }
            logger.info("使用ws配置:" + wsCfg.getClass().getName());
            WsModel model = wsCfg.getWsModel(code);
            if (model == null) {
                addActionMessage("未找到" + code + "对应的配置信息");
            }
            LotusOrgManager lotusOrgManager = getholyVatManager(model.getUrl());
            page = (Page<Map<String, Object>>) lotusOrgManager.findVatPageList(page,
                    "REPORTSQL.findOrgMessage", entity,orgModel, null);
            return LIST;
    }
    /**
     *lotus org数据查询
     * @return
     * @throws Exception
     */
    @SuppressWarnings("rawtypes")
    public String qryhistory ()throws Exception{
            orgModel.setCode("holylotus");
            String code = orgModel.getCode();
            if (StringUtil.isEmpty(code)) {
                addActionMessage("请选择公司");
            }
            if (wsCfg == null) {
                addActionMessage("未加载配置");
            }
            logger.info("使用ws配置:" + wsCfg.getClass().getName());
            WsModel model = wsCfg.getWsModel(code);
            if (model == null) {
                addActionMessage("未找到" + code + "对应的配置信息");
            }
            LotusOrgManager lotusOrgManager = getholyVatManager(model.getUrl());
            page = (Page<Map<String, Object>>) lotusOrgManager.findVatPageList(page,
                    "REPORTSQL.findOldOrgMessage", entity,null, null);
        return LIST;
    }
    /**
     * 机构明细方法
     * @return
     * @throws Exception
     */
    public String detail ()throws Exception{
            orgModel.setCode("holylotus");
            String code = orgModel.getCode();
            if (StringUtil.isEmpty(code)) {
                addActionMessage("请选择公司");
            }
            if (wsCfg == null) {
                addActionMessage("未加载配置");
            }
            logger.info("使用ws配置:" + wsCfg.getClass().getName());
            WsModel model = wsCfg.getWsModel(code);
            if (model == null) {
                addActionMessage("未找到" + code + "对应的配置信息");
            }
            LotusOrgManager lotusOrgManager = getholyVatManager(model.getUrl());
            page = (Page<Map<String, Object>>) lotusOrgManager.findVatPageList(page,
                    "REPORTSQL.findOneOrgMessage", entity,null, null);
            return SUCCESS;
        
    }
    /**
     * 机构信息修改
     * @return
     * @throws Exception
     */
    public String edit ()throws Exception{
        orgModel.setCode("holylotus");
        //String company = invModel.getCompany();
        String code = orgModel.getCode();
        if (StringUtil.isEmpty(code)) {
            addActionMessage("请选择公司");
        }
        if (wsCfg == null) {
            addActionMessage("未加载配置");
        }
        logger.info("使用ws配置:" + wsCfg.getClass().getName());
        WsModel model = wsCfg.getWsModel(code);
        if (model == null) {
            addActionMessage("未找到" + code + "对应的配置信息");
        }
        LotusOrgManager lotusOrgManager = getholyVatManager(model.getUrl());
        try {
                entity=lotusOrgManager.findInvById(entity.getOrgid());
                lotusentity.setOrgid(entity.getOrgid());
                lotusentity.setOrgcode(entity.getOrgcode());
                lotusentity.setOrgname(entity.getOrgname());
                lotusentity.setTaxno(entity.getTaxno());
                lotusentity.setTaxname(entity.getTaxname());
                lotusentity.setParentid(entity.getParentid());
                lotusentity.setOrgtype(entity.getOrgtype());
                lotusentity.setLinkman(entity.getLinkman());
                lotusentity.setPhone(entity.getPhone());
                lotusentity.setAddress(entity.getAddress());
                lotusentity.setEmail(entity.getEmail());
                lotusentity.setPostcode(entity.getPostcode());
                lotusentity.setBank(entity.getBank());
                lotusentity.setAccount(entity.getAccount());
                lotusentity.setExtracttype(entity.getExtracttype());
                lotusentity.setExtractsoftzone(entity.getExtractsoftzone());
                lotusentity.setScansoftzone(entity.getScansoftzone());
                lotusentity.setIsbottom(entity.getIsbottom());
                lotusentity.setOrglevel(entity.getTreelevel());
                lotusentity.setOrglayer(entity.getTreelayer());
                lotusentity.setCompany(entity.getCompany());
                lotusentity.setRemark(entity.getRemark());
                //lotusentity.setAutocommit(entity.GET);
                lotusentity.setCreateTime(entity.getCreateTime());
                lotusentity.setCreateBy(entity.getCreateBy());
                lotusentity.setLastModifyTime(entity.getLastModifyTime());
                lotusentity.setLastModifyBy(entity.getLastModifyBy());
                lotusentity.setExtf4(entity.getExtf4());
                lotusentity.setExtf5(entity.getExtf5());
                lotusentity.setOperationtype("0");
                lotusOrgManager.savelotus(lotusentity);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }    
        return SUCCESS;
    }
    public String update ()throws Exception{
        orgModel.setCode("holylotus");
        //String company = invModel.getCompany();
        String code = orgModel.getCode();
        if (StringUtil.isEmpty(code)) {
            addActionMessage("请选择公司");
        }
        if (wsCfg == null) {
            addActionMessage("未加载配置");
        }
        logger.info("使用ws配置:" + wsCfg.getClass().getName());
        WsModel model = wsCfg.getWsModel(code);
        if (model == null) {
            addActionMessage("未找到" + code + "对应的配置信息");
        }
        LotusOrgManager lotusOrgManager = getholyVatManager(model.getUrl());
        try {
            //entity=lotusOrgManager.findInvById(entity.getOrgid());//通过主键找到
            entity.setLastModifyTime(new Date());//更改修改人,为当前登录用户,修改时间当前系统时间
            loginUser=(String) getSession().getAttribute(Constants.LOGIN_NAME);
            entity.setLastModifyBy(loginUser);
            lotusOrgManager.updateGds(entity);
            TLotusAcOrg entity=null;
            setIsSuc("true");
        } catch (Exception e) {
            setIsSuc("false");
            e.printStackTrace();
        }
        return SUCCESS;
        
    }
     /**
     * @描述:删除勾选的机构
     * @作者:wg
     * @日期:2013-06-30
     * @return 
     * @throws Exception
     */
    public String delete()  throws Exception{
        orgModel.setCode("holylotus");
        //String company = invModel.getCompany();
        String code = orgModel.getCode();
        if (StringUtil.isEmpty(code)) {
            addActionMessage("请选择公司");
        }
        if (wsCfg == null) {
            addActionMessage("未加载配置");
        }
        logger.info("使用ws配置:" + wsCfg.getClass().getName());
        WsModel model = wsCfg.getWsModel(code);
        if (model == null) {
            addActionMessage("未找到" + code + "对应的配置信息");
        }
        LotusOrgManager lotusOrgManager = getholyVatManager(model.getUrl());
        try {
            //entity=lotusOrgManager.findInvById(entity.getOrgid());//通过主键找到
            //loginUser=(String) getSession().getAttribute(Constants.LOGIN_NAME);
            for(int i = 0;i< _chk.length;i++){
                if(StringUtils.isNotBlank(_chk[i])){
                    entity = lotusOrgManager.findInvById(Long.parseLong(_chk[i]));
                    lotusentity.setOrgid(entity.getOrgid());
                    lotusentity.setOrgcode(entity.getOrgcode());
                    lotusentity.setOrgname(entity.getOrgname());
                    lotusentity.setTaxno(entity.getTaxno());
                    lotusentity.setTaxname(entity.getTaxname());
                    lotusentity.setParentid(entity.getParentid());
                    lotusentity.setOrgtype(entity.getOrgtype());
                    lotusentity.setLinkman(entity.getLinkman());
                    lotusentity.setPhone(entity.getPhone());
                    lotusentity.setAddress(entity.getAddress());
                    lotusentity.setEmail(entity.getEmail());
                    lotusentity.setPostcode(entity.getPostcode());
                    lotusentity.setBank(entity.getBank());
                    lotusentity.setAccount(entity.getAccount());
                    lotusentity.setExtracttype(entity.getExtracttype());
                    lotusentity.setExtractsoftzone(entity.getExtractsoftzone());
                    lotusentity.setScansoftzone(entity.getScansoftzone());
                    lotusentity.setIsbottom(entity.getIsbottom());
                    lotusentity.setOrglevel(entity.getTreelevel());
                    lotusentity.setOrglayer(entity.getTreelayer());
                    lotusentity.setCompany(entity.getCompany());
                    lotusentity.setRemark(entity.getRemark());
                    //lotusentity.setAutocommit(entity.GET);
                    lotusentity.setCreateTime(entity.getCreateTime());
                    lotusentity.setCreateBy(entity.getCreateBy());
                    lotusentity.setLastModifyTime(entity.getLastModifyTime());
                    lotusentity.setLastModifyBy(entity.getLastModifyBy());
                    lotusentity.setExtf4(entity.getExtf4());
                    lotusentity.setExtf5(entity.getExtf5());
                    lotusentity.setOperationtype("1");
                    lotusOrgManager.savelotus(lotusentity);
                    
                }
            }
            List<TLotusAcOrg> agreelist =lotusOrgManager.delete(_chk, (String)getSession().getAttribute(Constants.LOGIN_NAME));    
            if(agreelist.size()>0){
                StringBuilder sb = new StringBuilder();
                addActionMessage(sb.toString());
            }else{
                addActionMessage("成功删除!");     
            }
        } catch (Exception e) {
            addActionMessage("删除失败!");
            e.printStackTrace();
        }
        
        return SUCCESS;
    }
    /**
     * @描述: 动态的生成一期库的管理类
     * @作者:byq
     * @日期:2012-9-14
     * @return:ILotusVatManager
     */
    private LotusOrgManager getholyVatManager(String address) {
        if (logger.isDebugEnabled()) {
            logger.debug("create LotusOrgManager client webservice...");
        }
        JaxWsProxyFactoryBean bean = new JaxWsProxyFactoryBean();
        Map<String, Object> outProps = new HashMap<String, Object>();
        outProps.put(WSHandlerConstants.ACTION,
                WSHandlerConstants.USERNAME_TOKEN);
        outProps.put(WSHandlerConstants.USER, "cxfClient");
        outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
        outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
                ClientPasswordCallback.class.getName());
        WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
        bean.getOutInterceptors().add(wssOut);
        bean.getOutInterceptors().add(new SAAJOutInterceptor());

        bean.setServiceClass(LotusOrgManager.class);
        bean.setAddress(address + "/services/LotusOrgManager");
        LotusOrgManager service = (LotusOrgManager) bean.create();
        return service;
    }
    public IWsCfg getWsCfg() {
        return wsCfg;
    }
    public LotusOrgModel getOrgModel() {
        return orgModel;
    }
    public void setOrgModel(LotusOrgModel orgModel) {
        this.orgModel = orgModel;
    }
    public LotusOrgManager getLotusOrgManager() {
        return lotusOrgManager;
    }
    public void setLotusOrgManager(LotusOrgManager lotusOrgManager) {
        this.lotusOrgManager = lotusOrgManager;
    }
    public void setWsCfg(IWsCfg wsCfg) {
        this.wsCfg = wsCfg;
    }
    public Page<Map<String, Object>> getPage() {
        return page;
    }
    public void setPage(Page<Map<String, Object>> page) {
        this.page = page;
    }
    public TLotusAcOrg getEntity() {
        return entity;
    }
    public void setEntity(TLotusAcOrg entity) {
        this.entity = entity;
    }
    @Override
    public TLotusAcOrg getModel() {
        // TODO Auto-generated method stub
        return entity;
    }
    public String[] get_chk() {
        return _chk;
    }
    public void set_chk(String[] _chk) {
        this._chk = _chk;
    }
    public TAcOrgdataBackup getLotusentity() {
        return lotusentity;
    }
    public void setLotusentity(TAcOrgdataBackup lotusentity) {
        this.lotusentity = lotusentity;
    }
    public String getLoginUser() {
        return loginUser;
    }
    public void setLoginUser(String loginUser) {
        this.loginUser = loginUser;
    }
  public Long getParentid() {
        return parentid;
    }
    public void setParentid(Long parentid) {
        this.parentid = parentid;
    }
    public Long getOrgid() {
        return orgid;
    }
    public void setOrgid(Long orgid) {
        this.orgid = orgid;
    }
}

(5)WsModel.jsva

package com.holytax.eipp.webservice.model;

public class WsModel {

    private String code;
    private String desc;
    private String url;
    private String tableName;
    
    public WsModel(){
        
    }
    
    public WsModel(String code, String desc, 
            String url){
        this.code = code;
        this.desc = desc;
        this.url = url;
    }
    
    public WsModel(String code, String desc, 
            String url, String tableName){
        this.code = code;
        this.desc = desc;
        this.url = url;
        this.tableName = tableName;
    }
    
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getTableName() {
        return tableName;
    }
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    @Override
    public String toString() {
        return "SystemModel [code=" + code + ", desc=" + desc + ", url=" + url
                + ", tableName=" + tableName + "]";
    }
    
}

(6)service-->manager.java

package com.holytax.eipp.msp.qorg.service;

  
import java.util.List;
import java.util.Map;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.holytax.base.service.IPage;
import com.holytax.eipp.msp.qorg.entity.TAcOrgdataBackup;
import com.holytax.eipp.msp.qorg.entity.TAcVangorgBackup;
import com.holytax.eipp.msp.qorg.entity.TLotusAcOrg;
import com.holytax.eipp.msp.qorg.entity.TVanguanOrg;
import com.holytax.eipp.msp.qorg.model.LotusOrgModel;
import com.holytax.eipp.webservice.adapter.MapAdapter;
import com.holytax.eipp.webservice.adapter.PageMapAdapter;
@WebService
public interface LotusOrgManager{
    /**
     *莲花部分,分页查询
     * @param mapPage
     * @param sql
     * @param entity
     * @param orgModel
     * @param mapParam
     * @return
     */
    @SuppressWarnings("unchecked")
    @WebMethod
    @XmlJavaTypeAdapter(PageMapAdapter.class)
    public IPage<Map<String, Object>> findVatPageList(
            @WebParam(name = "mapPage")
            @XmlJavaTypeAdapter(PageMapAdapter.class) 
            final IPage<Map<String, Object>> mapPage,
            @WebParam
            final String sql,
            @WebParam(name = "entity")
            final TLotusAcOrg entity,
            @WebParam(name = "invModel")
            final LotusOrgModel orgModel,
            @WebParam(name = "mapParam")
            @XmlJavaTypeAdapter(MapAdapter.class) final Map mapParam);
    
    
    @WebMethod
    public TLotusAcOrg findInvById(@WebParam(name = "id")final Long id);
    
    @WebMethod
    public TAcOrgdataBackup findOrgById(@WebParam(name = "id")final Long id);
    
    /**
     * 修改对象
     * @param entity
     * add by ZM 2010-11-23
     * @return 
     */
    @WebMethod
    public void updateGds(TLotusAcOrg entity);
    /**
     * 新增或是更新保存对象
     * @param entity
     * add by sjy 2010-11-15
     */
    @WebMethod
    public void save(TLotusAcOrg entity);
    
    
    @WebMethod
    public void savelotus(TAcOrgdataBackup lotusentity);
    
    /**
     * @描述: 删除选中商品
     * @作者: wg 
     * @日期:2015-5-19
     * @param ids 选中的id数组
     */
    @WebMethod
    public List<TLotusAcOrg> delete(String[] ids, String attribute);
}

(6)service-->managerImpl.java

public  class LotusOrgManagerImpl extends BaseManager implements LotusOrgManager{
    /**
    * @描述: 一期库发票修改查询
    * @作者:wg
    * @日期:2012-9-11
    * @return:void
    */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public IPage<Map<String, Object>> findVatPageList(
            final IPage<Map<String, Object>> mapPage,
            final String sql,
            final TLotusAcOrg entity,
            final LotusOrgModel orgModel,
            final Map mapParam){
        Map<String, Object> map = new HashMap<String, Object>();
        if(orgModel != null){
            map.putAll(ConvertUtils.pojoToMap(orgModel));
        }
        if(mapParam != null){
            map.putAll(mapParam);
        }
        if(entity != null){
            map.putAll(ConvertUtils.pojoToMap(entity));
        }
        Page<Map<String, Object>> queryResult = sqlDao.findPage((Page)mapPage, sql, map);
        return queryResult;
    }
    
    /**
     * 根据id查询对象
     * 
     */
    public TLotusAcOrg findInvById(Long id) {
        return (TLotusAcOrg) dao.findById(TLotusAcOrg.class, id);
    }
    /**
     * 根据id查询对象
     * 
     */
    public TAcOrgdataBackup findOrgById(Long id) {
        return (TAcOrgdataBackup) dao.findById(TAcOrgdataBackup.class, id);
    }
    /**
     * 修改对象
     * @param entity
     * add by wg 2010-11-23
     * @return 
     */
    public void updateGds(TLotusAcOrg entity){
         dao.saveOrUpdate(entity);
    }
    /**
     * 新增或是更新保存对象
     * @param entity
     * add by wg 2010-11-15
     */
    public void save(TLotusAcOrg entity){
         dao.save(entity);
    }
    
    public void savelotus(TAcOrgdataBackup lotusentity){
         dao.save(lotusentity);
    }
     /**
      * 删除选中数据
      */
    @Override
    public List<TLotusAcOrg> delete(String[] ids, String attribute) {
        List list = new ArrayList();
        TLotusAcOrg ent = null;
        for(int i = 0;i< ids.length;i++){
            if(StringUtils.isNotBlank(ids[i])){
                ent = this.findInvById(Long.parseLong(ids[i]));
            }
        //删除主表
        dao.delete(ent);                          
        }
        return list;
    }
}

(7)最后在总的配置文件配置sql.xml,spring.xml,strtus即可。。。。

(8)所谓的服务端,就是把客户端复制一份,,修改项目名。。。更改数据连接地址即可。。。还有一种情况,就是客户端,即是服务端,又是客户端,,但是流程是一样的。。。

 

你可能感兴趣的:(webServices 执行流程,(我是菜鸟,我怕谁,仅代表个人理解,欢迎各位大神们指导,不和您的胃口,请默默离开!!))