XML-RPC实现JAVA与DELPHI通信
- 格式:docx
- 大小:19.96 KB
- 文档页数:3
Delphi下实时通信的实现周婕【摘要】在讨论了TCP/IP通信原理的基础上,介绍了一套在Delphi应用中利用TCP/IP Socket接口进行实时通信的方法.【期刊名称】《电讯技术》【年(卷),期】2003(043)005【总页数】3页(P143-145)【关键词】计算机网络;TCP/IP通信;Winsock;Socket类;Delphi【作者】周婕【作者单位】海军装备论证研究中心,北京,102249【正文语种】中文【中图分类】工业技术吃i初」边L Jr 2003 茸第 5 期文章编号: 1001 - 893X(2003)05 - 0143 - 03 计算机与网络COJ飞1PUTER &NET、VORKDelphi 下实时通信的实现祷周嫂(海军装备论证研究中心,北京 102249)摘要:在讨论了 TCP/IP 通信原理的基础上,介绍了一套在 Delphi 应用中利用 TCP/IP Socket 接口进行实时通信的方法。
关键词:计算机网络; TCP/IP 通信; Winsock; Socket 类; Delphi中图分类号: 1凹93文献标识码: AImplementationof Real - timeCommunication in Delphi ZHOU Jie ( NavalResearchCenter, Beijing 102249, China) Abstract :节1e 1℃P/IP communication theoryis discussed.Subsequently a me由odforreal - timecommunication 白白1℃P/IP S侃ket inDelphiisintroduced.Key words: Computer network; TCP/IP communication; Win毗k; Socket class ; Delphi一、引作为目前世界上使用最广泛的数据库应用程序综合开发环境以及 MIS 开发工具之一, Borland 公司的Delphi 以其基于窗口和面向对象的编程方法、与Windows 操作系统紧密结合、强大的数据库技术支持、迅捷的编译速度、卓越的性能在开发人员当中赢得了经久不衰的盛誉。
在delphi中使用xml文档.txt心态决定状态,心胸决定格局,眼界决定境界。
当你的眼泪忍不住要流出来的时候,睁大眼睛,千万别眨眼,你会看到世界由清晰到模糊的全过程。
在delphi中使用xml文档[ 2006-3-16 10:33:00 | By: chys ]在delphi中使用xml文档有两种方法使用xml broker, 是delphi 内置的。
例:unit ShowXML;interfaceuses Classes HTTPApp Db DbClient MidasXMLBrokr WebComp MidItems;typeTCustomShowXMLButton = class(TXMLButton IScriptComponent)protectedXMLMethodName: string;{ IScriptComponent }procedure AddElements(AddIntf: IAddScriptElements);function GetSubComponents: TObject;{ IWebContent implementation }function ImplContent(Options: TWebContentOptions;ParentLayout: TLayout): string; override;end;TShowXMLButton = class(TCustomShowXMLButton)publicconstructor Create(AOwner: TComponent); override;publishedproperty Custom;property Style;property StyleRule;property Caption;property XMLBroker;property XMLUseParent;end;TShowDeltaButton = class(TCustomShowXMLButton)publicconstructor Create(AOwner: TComponent); override;publishedproperty Custom;property Style;property StyleRule;property Caption;property XMLBroker;property XMLUseParent;end;implementationuses sysutils MidProd;resourcest***sShowXML = 'Show XML';sShowDelta = 'Show Delta';procedure TCustomShowXMLButton.AddElements(AddIntf: IAddScriptElements);beginAddIntf.AddIncludeFile('xmlshow.js');end;function TCustomShowXMLButton.GetSubComponents: TObject;beginResult := nil;end;function TCustomShowXMLButton.ImplContent(Options: TWebContentOptions;ParentLayout: TLayout): string;varAttrs: string;Intf: ILayoutWebContent;FormVarName: string;RowSetVarName: string;beginAddQuotedAttrib(Attrs 'NAME' Name);AddQuotedAttrib(Attrs 'STYLE' Style);AddQuotedAttrib(Attrs 'CLASS' StyleRule);AddQuotedAttrib(Attrs 'VALUE' Self.Caption);AddCustomAttrib(Attrs Custom);if Assigned(XMLData.XMLBroker) thenbeginFormVarName := XMLData.XMLBroker.SubmitFormVarName;RowSetVarName := XMLData.XMLBroker.RowSetVarName(nil); // Row row set var name end;if not (coNoScript in Options.Flags) thenResult :=Format(''#13#10[Attrs RowSetVarName XMLMethodName sXMLRea***Var])elseResult :=Format(''#13#10[Attrs]);if Assigned(ParentLayout) and ParentLayout.GetInterface(ILayoutWebContent Intf) thenResult := youtButton(Result GetLayoutAttributes);end;{ TShowXMLButton }constructor TShowXMLButton.Create(AOwner: TComponent); begininherited;DefaultCaption := sShowXML;XMLMethodName := 'root';end;{ TShowDeltaButton }constructor TShowDeltaButton.Create(AOwner: TComponent); begininherited;DefaultCaption := sShowDelta;XMLMethodName := 'getDelta()';end;另一种方法使用msxml.dll 如下:........procedure TDHEDForm.OpenBtnClick(Sender: TObject);varpVIn : OleVariant;Prompt : OleVariant;beginpVIn := '';Prompt := True;DHtmlEdit1.LoadDocument(pVIn Prompt);end;procedure TDHEDForm.SaveBtnClick(Sender: TObject);varvo vb : OleVariant;beginvo := DHTMLEdit1.CurrentDocumentPath;if (vo <> '') thenbeginvb := false;endelsebeginvo := '';vb := true;end;DHTMLEdit1.SaveDocument(vo vb);end;procedure TDHEDForm.SaveAsClick(Sender: TObject);varvo vb : OleVariant;beginvo := '';vb := true;DHTMLEdit1.SaveDocument(vo vb);end;2005-12-29 13:41:48查看评语»»»2005-12-29 13:44:23 Delphi 对XML的支持---TXMLDocument类Delphi7 支持对XML文档的操作,可以通过TXMLDocument类来实现对XML文档的读写。
Package‘xmlrpc2’October14,2022Type PackageTitle Implementation of the Remote Procedure Call Protocol('XML-RPC')Version1.1Author Florian Schwendinger[aut,cre]Maintainer Florian Schwendinger<**************************>Description The'XML-RPC'is a remote procedure call protocolbased on'XML'.The'xmlrpc2'package is inspired by the'XMLRPC'package but uses the'curl'and'xml2'packages instead'RCurl'and'XML'.License GPL-3Imports curl,xml2,base64encRoxygenNote6.1.0NeedsCompilation noRepository CRANDate/Publication2018-08-2313:30:02UTCR topics documented:from_xmlrpc (1)rpc_serialize (2)to_xmlrpc (3)xmlrpc (3)Index5 from_xmlrpc Convert from the XML-RPC Format into an R Object.DescriptionConvert an object of class"xml_code"or a character in the XML-RPC Format into an R Object.12rpc_serializeUsagefrom_xmlrpc(xml,raise_error=TRUE)Argumentsxml a character string containing XML in the remote procedure call protocol format.raise_error a logical controling the behavior if the XML-RPC signals a fault.If TRUE an error is raised,if FALSE an object inheriting from"c("xmlrpc_error","error")"is returned.Valuean R object derived from the input.Examplesparams<-list(1L,1:3,rnorm(3),LETTERS[1:3],charToRaw("A"))xml<-to_xmlrpc("some_method",params)from_xmlrpc(xml)rpc_serialize Convert R Objects into the XML-RPC FormatDescriptionSerialize R Objects so they can be passed to to_xmlrpc as parameters.Usagerpc_serialize(x,...)Argumentsx an R object....additional optional arguments(currently ignored).Valuean object of class"xml_node".Examplesrpc_serialize(1L)rpc_serialize(1:2)rpc_serialize(LETTERS[1:2])to_xmlrpc3 to_xmlrpc Create a XML-RPC CallDescriptionabcUsageto_xmlrpc(method,params)Argumentsmethod a character string giving the name of the method to be invoked.params a list containing the parmeters which are added to the XMLfile sent via the remote procedure call.Valuean object of class"xml_node"containing a XML-RPC call.Examplesparams<-list(1L,1:3,rnorm(3),LETTERS[1:3],charToRaw("A"))cat(as.character(to_xmlrpc("some_method",params)))xmlrpc Call the Remote ProcedureDescriptionCall a reomte procedure with the XML-RPC protocol.Usagexmlrpc(url,method,params=list(),handle=NULL,opts=list(),convert=TRUE,useragent="xmlrpc",raise_error=TRUE)4xmlrpcArgumentsurl a character string giving the url to the server.method a character string giving the name of the method to be invoked.params a list containing the parmeters which are added to the XMLfile sent via the remoteprocedure call.handle a object of class"curl_handle".opts a list of options passed to the function"handle_setopt".convert a logical,if convert is TRUE(default)the curl response is converted else it is leftunchanged.useragent a character string giving the name of the"User-Agent".raise_error a logical controling the behavior if the status code of curl_fetch_memory sig-nals an error.If raise_error is TRUE an error is raised,if raise_error is FALSEno error is raised and an object inheriting from c("fetch_error",error")}is returned.This object is the return value from\code{curl_fetch_memory}where just the class\code{c("fetch_error",error")is added.Valuethe reponse of curl or the response converted to R objects.Examples##Not run:url<-"https://"xmlrpc(url,"listAllSolvers")xmlrpc(url,"listSolversInCategory",params=list(category="socp"))##End(Not run)Indexfrom_xmlrpc,1rpc_serialize,2to_xmlrpc,3xmlrpc,35。
客户端delphi使用XML与中间层C#.net通信的例子,客户端用idhttp的post发送请求1.客户端代码:1.unit Unit1;2.3.interface4.es6. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,7. Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,8. IdHTTP, StdCtrls;9.10.type11. TForm1 = class(TForm)12. IdHTTP1: TIdHTTP;13. Button1: TButton;14. Button2: TButton;15. Memo1: TMemo;16. procedure Button2Click(Sender: TObject);17. private18. { Private declarations }19. public20. { Public declarations }21. end;22.23.var24. Form1: TForm1;25.26.implementation27.28.{$R *.dfm}29.30.procedure TForm1.Button2Click(Sender: TObject);31.var32. respsm:TStringStream;33. AList:TStrings;34. uri:string;35.begin36. uri:='http://localhost:4983/WebSite3/Default.aspx';//这个地址换成自己的响应地址37. AList:=TStringList.Create;38. {中文乱码问题解决方法:发送过去之前先转码UTF8Encode,接收的时候再解码UTF8Decode}39. AList.Add(UTF8Encode(Memo1.Text));40.41. respsm:=TStringStream.Create('');42. //IdHTTP1.Get('http://localhost:4983/WebSite3/Default.aspx?id=3',sm);43. IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded';44. try45. IdHTTP1.Post(uri,AList,respsm);46. finally47. ShowMessage(UTF8Decode(respsm.DataString));//respsm.DataString为中间层返回的数据48. end;49.50. respsm.Free;51. AList.Free;52.53.end;54.55.end.客户端memo1.Text的内容为(在设计界面直接编辑memo1.lines,输入以下内容):1.<?xml version="1.0" encoding="utf-8" ?>2.<erp>3.<head>4.</head>5.<body>6.<client job="RoleInfo_New">7.<main job="New" ID="" Name="测试角色3" />8.</client>9.</body>10.</erp>中间层代码:(Default.aspx.cs)ing System;ing System.Data;ing System.Configuration;ing System.Web;ing System.Web.Security;ing System.Web.UI;ing System.Web.UI.WebControls;ing System.Web.UI.WebControls.WebParts;ing System.Web.UI.HtmlControls;10.//添加以下命名空间ing System.Xml;ing System.Data.Sql;ing System.Data.SqlClient;ing System.IO;ing System.Text;16.17.public partial class _Default : System.Web.UI.Page18.{19.protected void Page_Load(object sender, EventArgs e)20. {21.22. Stream sm = Request.InputStream;23. sm.Position = 0;24.byte[] buff = new byte[sm.Length];25.//char[] buff = new char[sm.Length];26.int len = (int)sm.Length;27. sm.Read(buff, 0, len);28.//StreamReader sr = new StreamReader(sm);29.//sr.Read(buff, 0, len);30.string str = Encoding.UTF8.GetString(buff);31.32. str = Server.UrlDecode(str);33.34.string ID = null;35.string[] AttrList = new string[2];36.37. XmlDocument dom = new XmlDocument();38. dom.LoadXml(str);39. XmlNodeList xnl = dom.GetElementsByTagName("client");40.if (xnl[0].Attributes[0].Value.ToString().StartsWith("RoleInfo_"))41. {42.if (xnl[0].Attributes[0].Value.ToString().EndsWith("New"))43. {44.for (int i = 0; i < AttrList.Length; i++)45. {46. AttrList[i] = xnl[0].ChildNodes[0].Attributes[i + 1].Value;47. }48. SqlConnection conn = new SqlConnection("server=.;database=test;uid=xj;pwd=123456");49. conn.Open();50. SqlCommand comm = new SqlCommand();51. comm.Connection = conn;52. mandText = "insert into RoleInfo(Name) values(@Name);select @@identity as id;";53. comm.Prepare();54.55. comm.Parameters.Add("@Name", SqlDbType.VarChar, 50);56. comm.Parameters[0].Direction = ParameterDirection.Input;57. comm.Parameters[0].Value = AttrList[1];58.//取刚插入数据库的记录的ID59. DataSet ds = new DataSet();60. SqlDataAdapter sda = new SqlDataAdapter(comm);61. sda.Fill(ds);62.63. comm.Dispose();64. conn.Close();65. conn.Dispose();66.67. ID = ds.Tables[0].Rows[0][0].ToString();68. //插入成功将ID返回给客户端69. Response.Clear();70. Response.ContentType = "text/xml";71. Response.Write("<?xml version=/"1.0/" encoding=/"utf-8/" ?>");72. Response.Write("<erp>");73. Response.Write("<head />");74. Response.Write("<body>");75. Response.Write("<server>");76. Response.Write("<main job=/"New/" ID=/"" + ID.ToString() + "/" />");77. Response.Write("</server>");78. Response.Write("</body>");79. Response.Write("</erp>");80.81. }82. }83. }84.}。
java rpc 方法===========一、介绍----RPC,即远程过程调用(Remote Procedure Call),是一种常见的编程范式,允许在两个不同的地方调用相同的数据结构和控制流程。
在Java环境中,使用RPC可以实现组件之间的解耦,提高系统的可扩展性和可维护性。
本篇文档将介绍Java中常见的RPC方法及其实现。
二、几种常见的Java RPC方法-------------1. **Java RMI(远程方法调用)**:Java RMI是Java提供的用于在不同Java虚拟机(JVM)之间进行通信的一种机制。
它允许远程对象调用在客户端代码中定义的方法。
2. **HTTP/RESTful API**:使用HTTP协议进行通信,通过定义一系列的HTTP方法(如GET、POST、PUT、DELETE等)来实现RPC调用。
Java中常用的框架如Spring MVC、Jersey等可以方便地实现RESTful API。
3. **gRPC**:gRPC是Google开发的一种高性能、开源的RPC框架,它支持多种语言,包括Java。
通过gRPC,可以在不同的系统之间进行高性能、高可靠性的通信。
4. **Thrift**:Thrift是一种跨语言的远程服务调用(RPC)框架,它支持多种编程语言,包括Java。
使用Thrift,可以很方便地定义服务接口,并生成相应的客户端和服务器代码。
5. **Dubbo**:Dubbo是阿里巴巴开源的一个高性能、轻量级的RPC框架,它支持多种通信协议和传输层协议,如HTTP/HTTPS、RMI、Kafka等,同时也支持负载均衡和容错。
三、Java RPC方法实现示例------------### 1. Java RMI示例首先,我们需要定义一个远程接口:```javainterface RemoteService extends Remote {void remoteMethod();}```接着,我们需要实现这个接口,并在服务器端注册这个远程对象:```javapublic class RemoteServiceImpl extends UnicastRemoteObject implements RemoteService {public RemoteServiceImpl() throws RemoteException { // 默认端口为1099,也可指定其他端口号}public void remoteMethod() {// 方法实现代码}}```在客户端,我们可以创建这个远程对象的引用并调用方法:```javaRemoteService remoteService = new RemoteServiceImpl(); // 创建远程对象引用remoteService.remoteMethod(); // 调用远程方法```### 2. HTTP/RESTful API示例(使用Spring MVC)首先,我们需要定义一个RESTful接口:```java@RestControllerpublic class RemoteServiceController {@GetMapping("/remoteMethod")public String remoteMethod() {// 方法实现代码return "远程方法调用成功";}}```然后,我们需要在前端发起HTTP请求来调用这个接口。
delphi调用java开发实例Delphi调用Java开发实例引言Delphi和Java是两种不同的编程语言,Delphi是由Embarcadero Technologies开发的面向对象的Pascal方言,而Java是由Sun Microsystems 开发的跨平台编程语言。
虽然它们拥有不同的语法和运行环境,但可以通过一些特定的技术来实现Delphi调用Java开发的需求。
本文将介绍一种使用Delphi 调用Java开发的实例,并一步一步回答相关问题。
章节一:环境搭建在开始之前,我们需要先搭建好开发环境,包括Delphi和Java的集成开发环境(IDE),以便进行代码编写和调试。
以下是搭建环境的步骤:1. 下载和安装最新版本的Delphi IDE。
您可以从Embarcadero Technologies 的官方网站上获取免费试用版或购买完整版本。
2. 下载和安装Java Development Kit(JDK)。
您可以从Oracle官方网站上下载最新版本的JDK,并按照安装向导中的说明进行安装。
3. 配置Delphi IDE以支持Java开发。
在Delphi IDE中,打开“Tools”菜单,选择“Options”,然后选择“Environment Options”子菜单,在新打开的对话框中选择“Java”选项卡。
在这里,您可以设置Java Runtime Environment (JRE)的路径,以及Java类路径(Classpath)和库路径(Library path)等。
章节二:创建Delphi项目在环境搭建完成后,我们可以开始创建Delphi项目,并编写Delphi代码来调用Java开发的功能。
以下是创建Delphi项目的步骤:1. 在Delphi IDE中,选择“File”菜单,然后选择“New”->“VCL Forms Application”来创建一个新的Delphi项目。
rpc的实现方式-回复【RPC的实现方式】远程过程调用(Remote Procedure Call,简称RPC)是一种分布式计算技术,它允许运行在一个计算机环境中的程序调用另一个地址空间(通常是网络中另一台计算机)的过程或函数,而开发者就像调用本地函数一样编写代码,无需关注底层通信细节。
本文将详细阐述RPC的实现方式,通过逐步解析其基本原理、核心组件及常见的几种实现方案。
一、RPC的基本原理1. 客户端-服务器模式:RPC的核心思想是基于客户端-服务器架构,客户端发起请求,服务器处理请求并返回结果。
客户端在本地定义一个服务接口,通过该接口像调用本地方法一样去调用远程服务器上的服务。
2. 消息序列化与反序列化:由于网络通信只能传输字节流,因此,在发送请求前,RPC框架需要将调用参数和调用信息进行序列化转换为二进制数据;接收方在接收到数据后,再将其反序列化还原为原始的数据结构。
3. 网络传输与寻址:RPC系统需要一种机制来定位远程服务的位置(如IP地址和端口号),并通过TCP/IP等协议将序列化后的请求数据发送给远程服务端。
4. 服务端响应与结果回调:服务端接收到请求后,执行相应的逻辑处理,并将结果以同样的方式序列化后通过网络回传给客户端。
客户端对接收到的结果进行反序列化,从而完成一次远程过程调用。
二、RPC的核心组件1. Stub(存根):Stub是客户端和服务端用于交互的代理模块。
客户端stub 负责将用户的本地调用转换为网络传输格式,并通过网络发送到服务端;服务端stub则负责接收请求,反序列化后调用实际的服务方法,最后将结果序列化后返回给客户端。
2. 调度器/服务注册中心:在某些复杂的RPC框架中,如Dubbo、gRPC,会有一个调度器或者服务注册中心,用于管理服务提供者的信息,客户端通过查询注册中心获取服务提供者的地址列表,然后根据负载均衡策略选择一个服务节点发起请求。
三、RPC的常见实现方式1. XML-RPC:基于HTTP协议和XML格式的数据编码,简单易用,但效率较低且功能有限。
Delphi中串口通信的实现Delphi是一种具有功能强大、简便易用和代码执行速度快等优点的可视化快速应用开发工具,它在构架企业信息系统方面发挥着越来越重要的作用,许多程序员愿意选择Delphi作为开发工具编制各种应用程序。
但是,美中不足之处是 Delphi没有自带的串口通信控件,在它的帮助文档里也没有提及串口通信,这就给编制通信程序的开发人员带来许多不便。
目前,利用 Delphi实现串口通信的常用的方法有3种:一是利用控件,如MSCOMM控件和 SPCOMM控件;二是使用 API函数;三是调用其他串口通信程序。
其中利用 API编写串口通信程序较为复杂,需要掌握大量的通信知识。
相比较而言,利用 SPCOMM控件则相对较简单,并且该控件具有丰富的与串口通信密切相关的属性及事件,提供了对串口的各种操作,而且还支持多线程。
下面本文结合实例详细介绍SPCOMM控件的使用。
SPCOMM的安装1.选择下拉菜单 Component中的 Install Component选项,在 Unit file name处填写SPCOMM控件所在的路径,其他各项可用默认值,点击 OK按钮。
2.安装后,在 System控件面板中将出现一个红色控件 COM。
现在就可以像 Delphi 自带控件一样使用 COM控件了。
SPCOMM的属性、方法和事件1.属性●CommName:表示 COM1、 COM2等串口的名字;●BaudRate:根据实际需要设定的波特率,在串口打开后也可更改此值,实际波特率随之更改;●ParityCheck:表示是否需要奇偶校验;●ByteSize:根据实际情况设定的字节长度;●Parity:奇偶校验位;●StopBits:停止位;●SendDataEmpty:这是一个布尔型属性,为 true时表示发送缓存为空,或者发送队列里没有信息;为 false时表示发送缓存不为空,或者发送队列里有信息。
2.方法●Startcomm方法用于打开串口,当打开失败时通常会报错。
XML-RPC实现JAVA与DELPHI通信
XML-RPC的全称是XML Remote Procedure Call,即XML远程方法调用。
它是一套允许运行在不同操作系统、不同环境的程序实现基于Internet过程调用的规范和一系列的实现。
这种远程过程调用使用HTTP作为传输协议,XML作为传送信息的编码格式。
XML-RPC的定义尽可能的保持了简单,但同时能够传送、处理、返回复杂的数据结构。
XML-RPC是工作在Internet上的远程过程调用协议。
一个XML-RPC消息就是一个请求体为xml的http-post请求,被调用的方法在服务器端执行并将执行结果以xml格式编码后返回。
XML-RPC实现对比
1、XML-RPC 同SOAP比较:由于Delphi SOAP客户端存在一些性能问题和同Java 实现存在一些兼容性问题,因此考虑采用XML-RPC实现,而且XML-RPC实现同SOAP实现相比较,性能要好很多。
2、XML-RPC 同SOCKET比较:采用HTTP协议可以有效穿透不同网络防火墙,中间件可以做成基于MVC的WEB应用服务器;采用XML-RPC主要考虑客户端改动量小、中间件容易搭建、数据传输快、稳定性高。
有成熟的框架可以使用,安全可靠。
数据传输的类型说明
< string > 字符的一个序列
< int > 有符号或无符号32-bit 整数值
< boolean > true(1)或false(0)
< double > 有符号双精度浮点数
< dateTime.iso8601 > 日期和时间(没有时区)
< base64 > 一个base64 编码的字符串
< array > 一个数据类型序列的容器(可递归)
< struct > 一个关键字-值对的容器(可递归)
TclientDataSet Delphi组件,可以直接加载的XML格式字符串
通信流程
请求开始->打包请求数据->发送请求数据->delphi端阻塞等待->Java端多线程响
应请求->解包请求数据->处理请求->打包处理结果->发送处理结果->delphi端停
止阻塞接收处理结果->解包处理结果->显示结果
主要问题描述
1、如何将Java从数据库中读出来的数据打包成TClientDataSet可以读取的数据包;要解决这个问题就需要深入了解TclientDataSet的DataPackage的xml格式。
TclientDataSet的DataPackage格式一般如下:
<?xml version="1.0" standalone="yes" ?>
<DATAPACKET Version="2.0">
<METADATA>
<FIELDS>
<FIELD attrname="PORT_ID" fieldtype="fixed" WIDTH="12" />
<FIELD attrname="OP_STATE" fieldtype="fixed" DECIMALS="1" WIDTH="38" />
<FIELD attrname="B_POL" fieldtype="fixed" WIDTH="38" />
<FIELD attrname="PORT_CUSTOMS_CODE" fieldtype="r8" />
<FIELD attrname="B_DEL" fieldtype="fixed" WIDTH="38" />
<FIELD attrname="B_SEA_PORT" fieldtype="r8" />
<FIELD attrname="PORT_AIRCODE" fieldtype="string" SUBTYPE="FixedChar" WIDTH="1" />
<FIELD attrname="PORT_SEACODE" fieldtype="string" SUBTYPE="FixedChar" WIDTH="2" />
<FIELD attrname="CREATE_DATE" fieldtype="dateTime" />
<FIELD attrname="B_BASIC" fieldtype="string" WIDTH="55" />
<FIELD attrname="EDI_CODE3" fieldtype="fixed" WIDTH="38" />
<FIELD attrname="B_LOCAL" fieldtype="fixed" DECIMALS="2" WIDTH="10" />
</FIELDS>
</METADATA>
<ROWDATA>
<ROW PORT_ID="10" OP_STATE="20.0" B_POL="3" />
<ROW PORT_ID="1" OP_STATE="2.0" B_POL="3" />
</ROWDATA>
</DATAPACKET>
2、如何将新增-修改-删除后的TClientDataSet数据通过Java保存到数据库中;要解决这个问题就需要深入了解TclientDataSet的Delta属性。
DataPackage的结构分析
整个XML定义了一个DataPacket;DataPacket包括两个部分:MetaData和RowData。
MetaData包括Fields和Params,即包括数据字段定义和数据集参数。
RowData为具体记录。
下面详细分析数据字段定义的方法。
Field节点的定义主要包括:
(1)attrname指FieldName
(2) fieldtype指字段类型
(3) width指需要宽度的字段类型的宽度或数字的有效位数;
(4) decimals指小数点右边的位数;
其中用SubType属性来帮助决定类型。
表中没有值的单元格,表示该属性没有用到。
并且DataPakage中如果想包含中文的话,记得要在第一句的中间加上encoding=”GB2312”,否则用数据库相关控件读出来的只会是乱码。
3、Delphi端如何调用Java端定义的对应的业务逻辑。
Delphi客户端直接通过XML-RPC向中间件发送HTTP POST请求,中间件接收请求,转servlet处理请求并响应。
4、Java端多用户并发处理效率问题。
WEB服务器servlet支持多线程并发处理。
5、数据包的格式定义打包解包问题。
解析了TClientDataSet的XML格式,JAVA中间件以TClientDataSet支持的XML 格式来装包。
JAVA中间件以XML-RPC支持的六个基本类型来解包。