用友NC-外部数据交换平台接口描述文档030926.doc

用友NC-外部数据交换平台接口描述文档030926.doc

ID:62989183

大小:28.50 KB

页数:6页

时间:2021-07-24

用友NC-外部数据交换平台接口描述文档030926.doc_第1页
用友NC-外部数据交换平台接口描述文档030926.doc_第2页
用友NC-外部数据交换平台接口描述文档030926.doc_第3页
用友NC-外部数据交换平台接口描述文档030926.doc_第4页
用友NC-外部数据交换平台接口描述文档030926.doc_第5页
资源描述:

《用友NC-外部数据交换平台接口描述文档030926.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、外部数据交换平台接口描述文档1.XML文件的导出和解析1,把数据包装成XML文件:示例:VoucherBrowseView.java建立输出流out=newPrintWriter(newFileWriter(dir+"/"+filename));输出到文件:象输出普通文本文件一样printxml(out,sep+sep+"");printxml(out,sep+sep+sep+""+(headvo.getDwbm()==null?"":headvo.getDwbm())+"");printxml(out,

2、sep+sep+sep+""+(headvo.getLbjc()==null?"":headvo.getLbjc())+"");printxml(out,sep+sep+sep+""+(headvo.getKjnd()==null?"":headvo.getKjnd())+"");printxml(out,sep+sep+sep+""+(headvo.getKjqj()==null?"":headvo.getKjqj())+"

3、cher_id>");printxml(out,sep+sep+sep+""+headvo.getFdjs()+"");printxml(out,sep+sep+sep+""+(headvo.getZdrq()==null?"":headvo.getZdrq())+"");2,发送文档到指定URL地址:a)获得连接publicURLConnectiongetConnection(Stringurl){//url=://webserver地址/servlet/nc.bs

4、.pfxx.manualload.ServletForXchange。URLConnectionconnection=null;try{//通过URL地址获得连接URLrealURL=newURL(url);URLConnectionconn=realURL.openConnection();//设置连接属性conn.setRequestProperty("Content-type","text/xml");connection=(URLConnection)conn;connection.setDoOutput(true);connection.setRequestM

5、ethod("POST");}catch(MalformedURLExceptionmex){mex.printStackTrace();}catch(ProtocolExceptionpex){pex.printStackTrace();}catch(IOExceptioniex){iex.printStackTrace();}returnconnection;}b)发送文档:publicvoidsendFile(Filefile){try{//获得一个输出流PrintWriterout=newPrintWriter(connection.getOutputStrea

6、m());//从文件获得输入BufferedReaderin1=newBufferedReader(newInputStreamReader(newFileInputStream(file),"gb2312"));//循环获得文件中的内容,并out发出Strings;while((s=in1.readLine())!=null){out.println(s);out.flush();}//关闭输出流out.close();}catch(Exceptionex){ex.printStackTrace();}}1,接收XML文档示例,从请求流中获得XML文档对象public

7、StreamToDoc(ServletRequestreq)throwsDTDCheckException{DOMParserparser=newDOMParser();try{//**获得InputStream对象,转换成InputSource*/InputStreamis=((InputStream)req.getInputStream());InputSourceinSrc=newInputSource(is);//**解析InputSource获得交换文档的Document对象*/parser.parse(inSrc);doc=p

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。