使用webservice中使用的类型可以是好多种,string、element、document等等甚至可以使对象! 我使用element来传输xml文件,写了一个文件,源码如下import java.io.Reader;import java.io.StringReader;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.util.HashMap;import java.util.Map;import javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory;import org.apache.xpath.XPathAPI;import org.w3c.dom.Document;import org.w3c.dom.Element;import org.w3c.dom.Node;import org.xml.sax.InputSource;/**工单查询接口 boos提供serialNumber、serviceNum输入参数@author joypen */public class WidebandBusinessQueryService { // 提供的查询方法 public Element queryWideband(Element requestXml) throws Exception { Map map = this.databaseMethod(requestXml); String responseXml = this.dealResponseXml(map); System.out.println("111 "+responseXml); Document doc = null; Reader strreader=new StringReader(responseXml); DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); doc = builder.parse(new InputSource(strreader)); return doc.getDocumentElement(); } // 连接数据库,并且执行sql语句 private Map databaseMethod(Element requestXml) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Map map = null; String serialNumber = null; String serviceNum = null; try { map = this.parseXml(requestXml); serialNumber = (String) map.get("SERIALNUMBER"); serviceNum = (String) map.get("SERVICENUM"); if(TextUtil.isNull(serialNumber) || "".equals(serialNumber) || TextUtil.isNull(serviceNum) || "".equals(serviceNum)){ map.put("ERRORCODE", "1"); map.put("DESCRIPTION", "SERIALNUMBER OR SERVICENUM IS WORING!"); }else{ conn = Helper.getDBCnn(); conn.setAutoCommit(false); String sqlString = this.sqlQueryString(serialNumber, serviceNum); ps = conn.prepareStatement(sqlString); rs = ps.executeQuery(); map = this.dealResult(rs); } } catch (Exception e) { System.out.print("WidebandBusinessQueryService--数据库连接出错!"); e.printStackTrace(); }finally{ try { rs =…