- 浏览: 96073 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
pug007:
您好。请问您是如何保证输出的json是按照{"tot ...
struts2 + hibernate + spring + flexgrid 分页实现 -
四书五经:
不错,记一笔。sorry,上面打错字了
MySql服务器的启动和关闭 -
四书五经:
不错,记不笔
MySql服务器的启动和关闭 -
VincentBoy:
不错 啊。
请问一下,你还有没有这个struts_JSON项 ...
struts2 + jquery + json模拟登陆效果 -
天空之城:
请问要是执行修改操作的时候,如何动态的默认显示?
comboboxTree的使用
利用AXIS开发WebService综合应用:
因项目需要,通过WebService传递对象及附件,最终返回结果对象。
1、开发服务端参数对象:
派单对象:
package com.starit.itsmhd.bean; import java.io.Serializable; import java.util.Date; /** * @author zqding * @version 1.0 * @date 2010-11-19 * @class_displayName ApplyItem * */ public class ApplyItem implements Serializable { private static final long serialVersionUID = -4997055778736225953L; // 事件流水号 private String applyserial; // 事件提出人 private String submitStaffName; // 事件标题 private String title; // 地点 private String place; // 事件发生时间 private Date occurTime; // 事件来源 private int origin; // 事件影响度 private int incidence; // 事件优先级 private int priority; // 事件完成期限 private Date finishLimit; // 所属系统类型 private int sysType; // 事件内容 private String content; // 附件标记 private boolean attachFlag; // 附件数量 private int fileNum; // 附件名称 private String[] attName; public ApplyItem() { } public String getApplyserial() { return applyserial; } public void setApplyserial(String applyserial) { this.applyserial = applyserial; } public boolean isAttachFlag() { return attachFlag; } public void setAttachFlag(boolean attachFlag) { this.attachFlag = attachFlag; } public String[] getAttName() { return attName; } public void setAttName(String[] attName) { this.attName = attName; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public int getFileNum() { return fileNum; } public void setFileNum(int fileNum) { this.fileNum = fileNum; } public Date getFinishLimit() { return finishLimit; } public void setFinishLimit(Date finishLimit) { this.finishLimit = finishLimit; } public int getIncidence() { return incidence; } public void setIncidence(int incidence) { this.incidence = incidence; } public Date getOccurTime() { return occurTime; } public void setOccurTime(Date occurTime) { this.occurTime = occurTime; } public int getOrigin() { return origin; } public void setOrigin(int origin) { this.origin = origin; } public String getPlace() { return place; } public void setPlace(String place) { this.place = place; } public int getPriority() { return priority; } public void setPriority(int priority) { this.priority = priority; } public String getSubmitStaffName() { return submitStaffName; } public void setSubmitStaffName(String submitStaffName) { this.submitStaffName = submitStaffName; } public int getSysType() { return sysType; } public void setSysType(int sysType) { this.sysType = sysType; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } }
派单返回对象:
package com.starit.itsmhd.bean; import java.io.Serializable; /** * @author zqding * @version 1.0 * @date 2010-11-21 * @class_displayName ApplyItemResponse */ public class ApplyItemResponse implements Serializable { private static final long serialVersionUID = -443142827992526070L; // 返回结果 private int result; // 服务保障流程号 private String fwbzSerial; // ITSM流程号 private String itsmSerial; // 返回信息 private String msg; public ApplyItemResponse() { } public String getFwbzSerial() { return fwbzSerial; } public void setFwbzSerial(String fwbzSerial) { this.fwbzSerial = fwbzSerial; } public String getItsmSerial() { return itsmSerial; } public void setItsmSerial(String itsmSerial) { this.itsmSerial = itsmSerial; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public int getResult() { return result; } public void setResult(int result) { this.result = result; } }
其它对象略...
2、配置wsdd文件:
<service name="FwbzService" provider="java:RPC" style="rpc" use="encoded"> <documentation>接口</documentation> <parameter name="allowedMethods" value="*"/> <parameter name="wsdlPortType" value="FwbzService"/> <parameter name="wsdlServicePort" value="FwbzService"/> <parameter name="wsdlServiceElement" value="FwbzService"/> <parameter name="className" value="com.starit.itsmhd.service.FwbzService"/> <parameter name="wsdlTargetNamespace" value="http://itsmhd.starit.com/service"/> <parameter name="wsdlServiceElement" value="FwbzService"/> <parameter name="schemaUnqualified" value="http://itsmhd.starit.com/bean,http://itsmhd.starit.com/exception"/> <!--派发--> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:ApplyItem" type="java:com.starit.itsmhd.bean.ApplyItem" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:ApplyItemResponse" type="java:com.starit.itsmhd.bean.ApplyItemResponse" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <!--查询--> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:QueryItem" type="java:com.starit.itsmhd.bean.QueryItem" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:QueryItemResponse" type="java:com.starit.itsmhd.bean.QueryItemResponse" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <!-- 取消--> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:CancelItem" type="java:com.starit.itsmhd.bean.CancelItem" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:CancelItemResponse" type="java:com.starit.itsmhd.bean.CancelItemResponse" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <!-- 关闭--> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:CloseItem" type="java:com.starit.itsmhd.bean.CloseItem" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:CloseItemResponse" type="java:com.starit.itsmhd.bean.CloseItemResponse" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <!--催单--> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:PromptItem" type="java:com.starit.itsmhd.bean.PromptItem" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:PromptItemResponse" type="java:com.starit.itsmhd.bean.PromptItemResponse" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <!--附件--> <arrayMapping xmlns:ns="http://itsmhd.starit.com/bean" qname="ns:ArrayOf_tns1_DataHandler" type="java:javax.activation.DataHandler[]" innerType="cmp-ns:DataHandler" xmlns:cmp-ns="http://xml.apache.org/xml-soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <!--异常--> <typeMapping xmlns:ns="http://itsmhd.starit.com/exception" qname="ns:AppException" type="java:com.starit.itsmhd.exception.AppException" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </service>
3、开发功能接口及实现和业务处理类:
package com.starit.itsmhd.interfaces; import java.rmi.Remote; import java.rmi.RemoteException; import javax.activation.DataHandler; import com.starit.itsmhd.bean.ApplyItem; import com.starit.itsmhd.bean.ApplyItemResponse; import com.starit.itsmhd.bean.CancelItem; import com.starit.itsmhd.bean.CancelItemResponse; import com.starit.itsmhd.bean.CloseItem; import com.starit.itsmhd.bean.CloseItemResponse; import com.starit.itsmhd.bean.PromptItem; import com.starit.itsmhd.bean.PromptItemResponse; import com.starit.itsmhd.bean.QueryItem; import com.starit.itsmhd.bean.QueryItemResponse; import com.starit.itsmhd.exception.AppException; /** * @author zqding * @version 1.0 * @date 2010-11-22 * @class_displayName FwbzInter */ public interface FwbzInter extends Remote { public ApplyItemResponse putEvent(ApplyItem applyItem, DataHandler[] attchments) throws RemoteException, AppException; public QueryItemResponse queryEvent(QueryItem queryItem) throws RemoteException, AppException; public CancelItemResponse cancelEvent(CancelItem cancelItem) throws RemoteException, AppException; public CloseItemResponse closeEvent(CloseItem closeItem, DataHandler[] attchments) throws RemoteException, AppException; public PromptItemResponse promptEvent(PromptItem promptItem) throws RemoteException, AppException; }
package com.starit.itsmhd.impl; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.rmi.RemoteException; import java.text.SimpleDateFormat; import javax.activation.DataHandler; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import com.primeton.tp.common.xml.XmlUtil; import com.primeton.tp.core.api.BizServiceCallerFactory; import com.primeton.tp.core.bizservice.ProcessCaller; import com.starit.itsmhd.bean.ApplyItem; import com.starit.itsmhd.bean.ApplyItemResponse; import com.starit.itsmhd.bean.CancelItem; import com.starit.itsmhd.bean.CancelItemResponse; import com.starit.itsmhd.bean.CloseItem; import com.starit.itsmhd.bean.CloseItemResponse; import com.starit.itsmhd.bean.PromptItem; import com.starit.itsmhd.bean.PromptItemResponse; import com.starit.itsmhd.bean.QueryItem; import com.starit.itsmhd.bean.QueryItemResponse; import com.starit.itsmhd.exception.AppException; import com.starit.itsmhd.interfaces.FwbzInter; /** * @author zqding * @version 1.0 * @date 2010-11-22 * @class_displayName FwbzImpl */ public class FwbzImpl implements FwbzInter { private static Log logger = LogFactory.getLog(FwbzImpl.class); public ApplyItemResponse putEvent(ApplyItem applyItem, DataHandler[] attchments) throws RemoteException, AppException { ApplyItemResponse resultObj = new ApplyItemResponse(); //ApplyItemResponse resultObj = null; String resultValue = null; String resultXML = ""; try { logger.info("开始处理 ITSM系统的工单派发请求接口<ITSM调服务保障>"); //1、如果有附件,先保存附件。 logger.info("保存附件"); String[] fileNames = applyItem.getAttName(); String[] fNames = {"222.pdf","222.rar"}; SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); String inputXML = ""; if(applyItem.isAttachFlag()){ for(int i =0 ;i < fileNames.length ; i++){ logger.info("保存文件" + i +":"+ fileNames[i]); String fullPath = "C:/" + fNames[i]; File file = new File(fullPath); int flag = 0; try { InputStream input = attchments[i].getInputStream(); FileOutputStream fos = new FileOutputStream(file); byte[] buffer=new byte[4096]; while((flag=input.read(buffer))!=-1){ fos.write(buffer,0,flag); } input.close(); fos.close(); } catch (IOException e) { e.printStackTrace(); } } } //2、向保障系统派单 logger.info("参数列表:"); logger.info("ITSM事件流水号:" + applyItem.getApplyserial()); logger.info("事件提出人:" + applyItem.getSubmitStaffName()); logger.info("事件标题:" + applyItem.getTitle()); logger.info("事件发生地址:" + applyItem.getPlace()); logger.info("事件发生时间:" + df.format(applyItem.getOccurTime())); logger.info("事件来源:" + applyItem.getOrigin()); logger.info("事件影响度:" + applyItem.getIncidence()); logger.info("事件优先级:" + applyItem.getPriority()); logger.info("事件完成期限:" + df.format(applyItem.getFinishLimit())); logger.info("所属系统类型:" + applyItem.getSysType()); logger.info("事件内容:" + applyItem.getContent()); logger.info("附件标记:" + applyItem.isAttachFlag()); logger.info("附件数量:" + applyItem.getFileNum()); logger.info("附件名称:" + StringUtils.join(applyItem.getAttName(), ",")); inputXML = "<?xml version=\"1.0\" encoding=\"GB2312\"?><root><data>" + "<applySerial>" + applyItem.getApplyserial() + "</applySerial>" + "<submitStaffName>" + applyItem.getSubmitStaffName() + "</submitStaffName>" + "<title>" + applyItem.getTitle() + "</title>" + "<place>" + applyItem.getPlace() + "</place>" + "<occurTime>" + df.format(applyItem.getOccurTime()) + "</occurTime>" + "<origin>" + applyItem.getOrigin() + "</origin>" + "<incidence>" + applyItem.getIncidence() + "</incidence>" + "<priority>" + applyItem.getPriority() + "</priority>" + "<finishLimit>" + df.format(applyItem.getFinishLimit()) + "</finishLimit>" + "<sysType>" + applyItem.getSysType() + "</sysType>" + "<content>" + applyItem.getContent() + "</content>" + "<attachFlag>" + applyItem.isAttachFlag() + "</attachFlag>" + "<fileNum>" + applyItem.getFileNum() + "</fileNum>" + "<attName>" + StringUtils.join(applyItem.getAttName(), ",") + "</attName>" + "</data></root>"; logger.info("派单输入信息:" + inputXML); resultXML = callBiz("spi", "bizITSM_Fault_Interface.bizITSM_BZ_PDintf", inputXML); logger.info("派单返回信息:" + resultXML); } catch (Exception e) { resultValue = "调用 服务保障系统工单派发接口失败,原因"; resultValue = resultValue + e.getMessage(); logger.info("异常原因:" + resultValue); throw new AppException(resultValue, null); } //3、把派单返回信息转成Document对象并赋值给ApplyItemResponse->resultObj对象 Document doc; try { doc = stringToDoc(resultXML); NodeList nodes = doc.getElementsByTagName("data"); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); NodeList childNodes = node.getChildNodes(); for (int j = 0; j < childNodes.getLength(); j++) { Node childNode = childNodes.item(j); if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getNodeName().equals("result")) resultObj.setResult(new Integer(childNode.getFirstChild().getNodeValue())); if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getNodeName().equals("fwbzSerial")) resultObj.setFwbzSerial(childNode.getFirstChild().getNodeValue()); if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getNodeName().equals("itsmSerial")) resultObj.setItsmSerial(childNode.getFirstChild().getNodeValue()); if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getNodeName().equals("msg")) resultObj.setMsg(childNode.getFirstChild().getNodeValue()); } } } catch (Exception e) { resultValue = "派单结果转换失败,原因"; resultValue = resultValue + e.getMessage(); logger.info("异常原因:" + resultValue); throw new AppException(resultValue, null); } return resultObj; } ...... /** * String 转 XML org.w3c.dom.Document */ private static Document stringToDoc(String xmlStr) { // 字符串转XML Document doc = null; try { xmlStr = new String(xmlStr.getBytes(), "gb2312"); StringReader sr = new StringReader(xmlStr); InputSource is = new InputSource(sr); DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder; builder = factory.newDocumentBuilder(); doc = builder.parse(is); } catch (ParserConfigurationException e) { System.err.println(xmlStr); e.printStackTrace(); } catch (SAXException e) { System.err.println(xmlStr); e.printStackTrace(); } catch (IOException e) { System.err.println(xmlStr); e.printStackTrace(); } return doc; } /** * XML org.w3c.dom.Document 转 String */ private static String docToString(Document doc) { // XML转字符串 String xmlStr = ""; try { TransformerFactory tf = TransformerFactory.newInstance(); Transformer t = tf.newTransformer(); t.setOutputProperty("encoding", "gb2312");// 解决中文问题,试过用GBK不行UTF-8 ByteArrayOutputStream bos = new ByteArrayOutputStream(); t.transform(new DOMSource(doc), new StreamResult(bos)); xmlStr = bos.toString(); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } return xmlStr; } }
package com.starit.itsmhd.service; import java.rmi.RemoteException; import javax.activation.DataHandler; import org.w3c.dom.*; import com.primeton.tp.core.api.BizContext; import com.starit.itsmhd.bean.ApplyItem; import com.starit.itsmhd.bean.ApplyItemResponse; import com.starit.itsmhd.bean.CancelItem; import com.starit.itsmhd.bean.CancelItemResponse; import com.starit.itsmhd.bean.CloseItem; import com.starit.itsmhd.bean.CloseItemResponse; import com.starit.itsmhd.bean.PromptItem; import com.starit.itsmhd.bean.PromptItemResponse; import com.starit.itsmhd.bean.QueryItem; import com.starit.itsmhd.bean.QueryItemResponse; import com.starit.itsmhd.exception.AppException; import com.starit.itsmhd.impl.FwbzImpl; import com.starit.itsmhd.interfaces.FwbzInter; /** * @author zqding * @version 1.0 * @date 2010-11-22 * @class_displayName FwbzService */ public class FwbzService implements FwbzInter { private FwbzInter impl; public FwbzService() { this.impl = new FwbzImpl(); } public FwbzService(FwbzInter impl) { this.impl = impl; } //派单 public ApplyItemResponse putEvent(ApplyItem applyItem, DataHandler[] attchments) throws RemoteException, AppException { ApplyItemResponse ret = impl.putEvent(applyItem, attchments); return ret; } //查询工单 public QueryItemResponse queryEvent(QueryItem queryItem) throws RemoteException, AppException { QueryItemResponse ret = impl.queryEvent(queryItem); return ret; } //取消工单 public CancelItemResponse cancelEvent(CancelItem cancelItem) throws RemoteException, AppException { CancelItemResponse ret = impl.cancelEvent(cancelItem); return ret; } //关闭工单 public CloseItemResponse closeEvent(CloseItem closeItem, DataHandler[] attchments) throws RemoteException, AppException { CloseItemResponse ret = impl.closeEvent(closeItem, attchments); return ret; } //催单 public PromptItemResponse promptEvent(PromptItem promptItem) throws RemoteException, AppException { PromptItemResponse ret = impl.promptEvent(promptItem); return ret; } }
4、测试代码:
package com.starit.itsmhd.testcase; import java.io.File; import java.rmi.RemoteException; import java.util.Date; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.rpc.ServiceException; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.ser.BeanDeserializerFactory; import org.apache.axis.encoding.ser.BeanSerializerFactory; import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory; import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory; import com.starit.itsmhd.bean.ApplyItem; import com.starit.itsmhd.bean.ApplyItemResponse; import com.starit.itsmhd.bean.CancelItem; import com.starit.itsmhd.bean.CancelItemResponse; import com.starit.itsmhd.bean.CloseItem; import com.starit.itsmhd.bean.CloseItemResponse; import com.starit.itsmhd.bean.PromptItem; import com.starit.itsmhd.bean.PromptItemResponse; import com.starit.itsmhd.bean.QueryItem; import com.starit.itsmhd.bean.QueryItemResponse; import com.starit.itsmhd.exception.AppException; /** * @author zqding * @version 1.0 * @date 2010-11-22 * @class_displayName TestCase */ public class TestCase { public static void main(String[] args) { putSheet(); ...... } public static int putSheet() { String[] fileNames = { "d:/111.pdf", "d:/111.rar" }; ApplyItem item = new ApplyItem(); item.setApplyserial("111111111"); item.setSubmitStaffName("wangyongq"); item.setTitle("测试单"); item.setPlace("xxx"); item.setOccurTime(new Date()); item.setOrigin(11); item.setIncidence(12); item.setPriority(12); item.setFinishLimit(new Date()); item.setSysType(10006); item.setContent("xxxx测试单"); item.setFileNum(2); item.setAttName(fileNames); item.setAttachFlag(true); DataHandler[] dataHandler = new DataHandler[item.getFileNum()]; for (int i = 0; i < item.getFileNum(); i++) { File file = new File(item.getAttName()[i]); FileDataSource source = new FileDataSource(file); dataHandler[i] = new DataHandler(source); } ApplyItemResponse response;// = new ApplyItemResponse(); Call call; try { String url = "http://127.0.0.1:7001/axis/services/FwbzService"; Service service = new Service(); call = (Call) service.createCall(); call.setTargetEndpointAddress(url); // 设定服务方法名 call.setOperationName(new QName(url, "putEvent")); QName qna = new QName("http://itsmhd.starit.com/bean", "ApplyItem"); QName qnd = new QName("http://itsmhd.starit.com/bean", "ArrayOf_tns1_DataHandler"); QName returnType = new QName("http://itsmhd.starit.com/bean", "ApplyItemResponse"); QName ae = new QName("http://itsmhd.starit.com/bean", "AppException"); call.registerTypeMapping(ApplyItem.class, qna, new BeanSerializerFactory(ApplyItem.class, qna), new BeanDeserializerFactory(ApplyItem.class, qna)); call.registerTypeMapping(DataHandler.class, qnd, JAFDataHandlerSerializerFactory.class, JAFDataHandlerDeserializerFactory.class); call.registerTypeMapping(ApplyItemResponse.class, returnType, new BeanSerializerFactory(ApplyItemResponse.class,returnType), new BeanDeserializerFactory(ApplyItemResponse.class,returnType)); call.registerTypeMapping(AppException.class, ae, new BeanSerializerFactory(AppException.class,ae), new BeanDeserializerFactory(AppException.class,ae)); // 设置参数占位符 call.addParameter("arg1", qna, ParameterMode.IN); call.addParameter("arg2", qnd, ParameterMode.IN); call.setReturnType(returnType); // 设置Webservice超时时间 call.setTimeout(new Integer(10000)); // 调用服务并获取服务调用返回信息 response = (ApplyItemResponse) call.invoke(new Object[] { item, dataHandler }); System.out.println("调用结果:response>>>>>>>>>>>>>>>>>>>>>>>>" + response.getMsg()); } catch (ServiceException e) { e.printStackTrace(); System.out.println("service method exception!"); // 调用Webservice异常时,设置标识值,直接返回 return 2; } catch (AppException e) { e.printStackTrace(); return 2; } catch (Exception e) { System.out.println("remote mothod exception!"); e.printStackTrace(); return 2; } return 1; }
.......
}
相关推荐
ta_lib-0.5.1-cp312-cp312-win32.whl
课程设计 在线实时的斗兽棋游戏,时间赶,粗暴的使用jQuery + websoket 实现实时H5对战游戏 + java.zip课程设计
ta_lib-0.5.1-cp310-cp310-win_amd64.whl
基于springboot+vue物流系统源码数据库文档.zip
GEE训练教程——Landsat5、8和Sentinel-2、DEM和各2哦想指数下载
知识图谱
333498005787635解决keil下载失败的文件.zip
【微信机器人原理与实现】 微信机器人是通过模拟微信客户端的行为,自动处理消息、发送消息的程序。在Python中实现微信机器人的主要库是WeChatBot,它提供了丰富的接口,允许开发者方便地进行微信消息的接收与发送。这个项目标题中的"基于python实现的微信机器人源码"指的是使用Python编程语言编写的微信机器人程序。 1. **Python基础**:Python是一种高级编程语言,以其简洁的语法和强大的功能深受开发者喜爱。在实现微信机器人时,你需要熟悉Python的基本语法、数据类型、函数、类以及异常处理等概念。 2. **微信API与WeChatBot库**:微信为开发者提供了微信公共平台和微信开放平台,可以获取到必要的API来实现机器人功能。WeChatBot库是Python中一个用于微信开发的第三方库,它封装了微信的API,简化了消息处理的流程。使用WeChatBot,开发者可以快速搭建起一个微信机器人。 3. **微信OAuth2.0授权**:为了能够接入微信,首先需要通过OAuth2.0协议获取用户的授权。用户授权后,机器人可以获取到微信用户的身份信息,从而进行
基于springboot实验室研究生信息管理系统源码数据库文档.zip
张力控制,色标跟踪,多轴同步,电子凸轮,横切等工艺控制案例。
在Python编程环境中,处理Microsoft Word文档是一项常见的任务。Python提供了几个库来实现这一目标,如`python-docx`,它可以让我们创建、修改和操作.docx文件。本教程将重点介绍如何利用Python进行Word文档的合并、格式转换以及转换为PDF。 1. **合并Word文档(merge4docx)** 合并多个Word文档是一项实用的功能,特别是在处理大量报告或文档集合时。在Python中,可以使用`python-docx`库实现。我们需要导入`docx`模块,然后读取每个文档并将其内容插入到主文档中。以下是一个基本示例: ```python from docx import Document def merge4docx(file_list, output_file): main_doc = Document() for file in file_list: doc = Document(file) for paragraph in doc.paragraphs: main_doc.add_paragraph(paragraph.text) m
基于springboot+Javaweb的二手图书交易系统源码数据库文档.zip
基于springboot餐品美食论坛源码数据库文档.zip
基于springboot亚运会志愿者管理系统源码数据库文档.zip
使用WPF的数据样式绑定,切换对象数据值来完成控件动态切换背景渐变动画效果。 使用动画样式渲染比线程修改性能消耗更低更稳定
基于SpringBoot的企业客源关系管理系统源码数据库文档.zip
基于springboot+vue的桂林旅游网站系统源码数据库文档.zip
基于springboot嗨玩旅游网站源码数据库文档.zip
基于springboot的流浪动物管理系统源码数据库文档.zip
基于springboot课件通中小学教学课件共享平台源码数据库文档.zip