简体   繁体   English

与RPG和.NET来回传递XML

[英]Passing XML back and forth with RPG and .NET

I am at a loss here of a best-practice to pass XML back and forth with RPG and C#.NET. 在这里,我无所适从与RPG和C#.NET来回传递XML的最佳实践。 Originally, I was going to use a temp physical file in QTEMP, but it seems to be that there should be a better way. 最初,我打算在QTEMP中使用一个临时物理文件,但似乎应该有一个更好的方法。 The temp file has one line of the document in one record of the file. 临时文件在文件的一条记录中有一行文档。 To me this seems to add a lot of extra work that really shouldn't be needed. 对我来说,这似乎增加了很多不必要的工作。 I am looking for a two-way communication. 我正在寻找双向通讯。

One thought is to pass a 32000 char parameter back and forth, but is that really a good idea? 一个想法是来回传递一个32000 char参数,但这真的是一个好主意吗? What happens if the document happens to be bigger than that? 如果文档碰巧大于该尺寸会怎样? I don't think I would hit that limit so maybe I would be fine? 我认为我不会达到这个极限,所以也许我会好起来吗?

What about creating a temp IFS file? 如何创建临时IFS文件? That seems like more work than is needed as well. 这似乎比需要的工作还要多。

What are your thoughts? 你怎么看?

Obviously, both the RPG and C# programs will be reading and processing the XML document. 显然,RPG和C#程序都将读取和处理XML文档。

DB2 supports XML in the database. DB2在数据库中支持XML。 Maybe your RPG can insert into the database (native program on the iSeries). 也许您的RPG可以插入数据库(iSeries上的本机程序)。 Your C#.NET program can use ODBC to retrieve from the database. 您的C#.NET程序可以使用ODBC从数据库中检索。 If you use the XML possibilities of DB2 then you won't loose the tags and xml structure. 如果您使用DB2的XML功能,那么您将不会丢失标签和xml结构。 Otherwise you can always use the CLOB or BLOB columns of a DB2 table. 否则,您始终可以使用DB2表的CLOB或BLOB列。

Creating the file in QTEMP will not work. 在QTEMP中创建文件将不起作用。 That library is unique for every job. 该库对于每个工作都是唯一的。 In other words, every job has his own QTEMP. 换句话说,每个作业都有自己的QTEMP。 You can see the QTEMP of jobs with DSPJOB, but you can not access the QTEMP. 您可以使用DSPJOB查看作业的QTEMP,但无法访问QTEMP。 And I am quite sure that your C#.NET program does not run in the same iSeries job as your RPG ... 而且我非常确定您的C#.NET程序不会在与RPG相同的iSeries作业中运行...

RPG do handle his parameters quite well. RPG确实很好地处理了他的参数。 I don't know the exact maximum size from the top of my head, but it is reasonable big. 从头顶上我不知道确切的最大尺寸,但这是合理的大尺寸。 So, you won't have a technical issue. 因此,您不会遇到技术问题。 But I think you will have a development issue. 但是我认为您会遇到发展问题。 I've tried to debug program call with many, and/or big values for the parameters. 我尝试调试许多参数和/或较大值的程序调用。 Believe me, that was no fun in the native iSeries debugger 8-( 相信我,这在本机iSeries调试器8-(

In my current job we do use MQ a lot to communicate between programs. 在我目前的工作中,我们确实使用MQ来在程序之间进行通信。 MQ is available on many platforms and it has interfaces for many languages. MQ在许多平台上都可用,并且具有用于多种语言的接口。 It is messaging instead of direct calls (different then your question) but it works great. 它是消息传递而不是直接呼叫(与您的问题不同),但是效果很好。 You can put any object (small, big, XML or binary file) into the queue and the program on the other side (eg your C# program) will receive it exactly the same. 您可以将任何对象(小,大,XML或二进制文件)放入队列中,另一端的程序(例如C#程序)将收到完全相同的对象。

At last, don't forget that the iSeries do have Java on board. 最后,不要忘记iSeries确实包含Java。 Class libraries for XML including Xalan are available. 提供了XML的类库,包括Xalan。 Maybe that is the way to go. 也许那是要走的路。 Gather the values in RPG, create and send the XML with Java. 收集RPG中的值,使用Java创建并发送XML。 Java and RPG works together fine. Java和RPG可以很好地协同工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM