>>
APLDN Home

>>
Events

>>
Trainings

>>
APL Books

>>
APLDN Links

>>
Discussion Groups

>>
Downloads

>>
Articles

>>
Library

>>
Learning Tools

>>
APLDN User IO

>>
APL2000.com




APL+WebTransfer and Objects

Posted by on Thursday, May 13, 2004 (EST)
This article has been Downloaded: 1062 times

Tranferring complex data structures over the Internet has historically been a difficult proposition. APL+WebTransfer has been designed to make the transfer of complex data trivial, even making it possible to transfer complex data between programs and languages.

As APL+WebTransfer has been designed to work either as a com object or as a .Net assembly, it can be used in almost any programming language. This means that you can have data sent to your APL session from VB programs, .Net language programs, C++ programs, .asp and .aspx pages and much more. Additionally you can return data to those programs, all by simply calling a method.

 

APL to APL

 

APL+WebTransfer has been designed for the transfer of data between an APL session and APL+WebServices.

 

If we create a variable such as:

 

res„10 20 (10 10½›'test') 'what' (3 3½¼9)

 

It has historically been difficult to send this data structure over the Internet, as the Internet is designed to transfer only UTF8 text.

 

To make it possible to send this data structure, we use Microsoft’s Binary Serializer and Soap Serializer in APL+WebTransfer.

 

Using the Binary Serializer

 

So, to send this data to the APL+WebServices, we could write some code such as:

 

'wt' Œwi 'Create' 'APL2000.WebTransfer'

'wt' Œwi 'XOpen' 'http://localhost/'

'wt' Œwi 'XSendObject' '/complex' res

 

This will send the res variable. The XSendObject will automatically serialize the data using Binary serialization. In the APL+WebServices we could select a “rarg” for the /complex virtual path to have an input name of “data” with a type set to “binarywrapl”. In the APL session, the function called would see the original complex data structure as its right argument.

 

 

 

That is all that is required to transfer the complex data structure between APL sessions. To return a complex data structure to the client, set the result to apl2binarywrapl.

 

 

The client APL session will then see the complex data structure returned by the server APL session.

 

It is not required to have both the send and return be binary data. You could send text and return binary, or send binary and receive text. The APL+WebTransfer automatically does the serialization and deserialization of the data being transferred. So, the APL workspaces always see only the APL data.

 

This facility makes it possible to move large and complex data structures easily between an APL client workspace and an APL server workspace.

 

Additionally the transfer is very efficient, as the data being sent is smaller than the internal data representation in APL. This can also be used with the XASendObject to send and receive the data asynchronously. When using XASendObject the complex data returned from the server is in the “returnedObject” property.

 

 

C#, and other languages to APL, or APL to other languages!

 

It is also possible to send data from programs written in other languages to APL and return data to those programs.

 

You can use APL+WebTransfer to transfer data from VB applications, C#, J#, etc, and .asp and .aspx pages to your APL+WebServices server.

 

For instance in C# we would use:

 

                  WebTransfer dl = new WebTransfer();

                  dl.Open("http://localhost");

                  dl.CompleteCallback += new TransferCompleteHandler( DownloadCompleteCallback );

                  dl.DownloadProgressCallback += new DownloadProgressHandler( DownloadProgressCallback );

                  dl.UploadProgressCallback += new UploadProgressHandler( UploadProgressCallback );

                  object[] pd = new object[2]{3,"test"};

                  res = dl.SendObject("/echo",pd);  // this will send the data synchronously

                  res = dl.ASendObject("/echo",pd);  // this will send the data asynchronously   

 

Virtually the same syntax would work for most other languages. So, if you have a client who needs to retrieve data from your server for an .asp or .aspx web page, you can have him use the APL+WebTransfer to facilitate the data transfer.

 

Your customer in this case will not have to learn anything new to move data to your server, or to receive data from your server. All you have to do is agree on the data to be sent back and forth.

 

This is an ideal way to share data with other programs and also to interact with .asp and .aspx pages.

 

 

APL data in SOAP

 

The APL+WebTransfer can also convert your APL data to SOAP. You can use this to transfer data between APL sessions, but as it is SOAP, it consumes significantly more memory than the original data. There are two methods that address creating SOAP from an APL variable. The first is XSendSoapObject for synchronous transfer and XASendSoapObject for transferring data asynchonously. The place where this is best applied is when you have a client who needs to receive the data as SOAP. If you would like to see what the SOAP looks like, you can use the XASendSoapObject to send the data, and then set the server to the entity-body type for the right argument to your function. The right argument of your function will be the raw SOAP sent from the APL+WebTransfer.


Bad
Good|Rate Item
Average Rating:

Comments:

APL font problem?
By Ric.Sherlock on Friday, August 20, 2004 (EST)
When I look at the articles published here using FireFox, generally the APL code looks fine. However this one does not display correctly (looks OK in IE though) Is there anything different about this article - or is it something at my end?

Reply to this Comment   

This article is different from the other you commented on
By j.merrill on Monday, August 23, 2004 (EST)
As far as the APL fonts are concerned, this article uses the construct (inside the ## signs I use as delimiters because I can't type line breaks into these messages on this PC) ##<SPAN style="FONT-FAMILY: APLPLUS">## while the other one uses the more-likely-to-be-valid-in-all-browsers construct ##<FONT face=APLPLUS>##. I don't know why they did things differently. Also, a quick google suggests that the first one is somewhat incorrect because the "APLPLUS" is not followed by a semi-colon (before the double-quote) as it is in every example I saw.

Reply to this Comment   

APLPLUS font not displayed correctly
By Ric.Sherlock on Wednesday, August 25, 2004 (EST)
Having a closer look myself, the common theme (same for the Library too) is that wherever the APLPLUS font is specifed the code doesn't display correctly in Firefox. Wherever APLHELP is used the code displays correctly. Is there any advantage of using APLPLUS over APLHELP? If not it would probably make sense to only use APLHELP to display code in web pages?

Reply to this Comment   

Re: APLPLUS font not displayed correctly
By Support on Thursday, August 26, 2004 (EST)
The major difference between the APLHELP and APLPLUS fonts is that APLHELP is an ANSI font whereas APLHELP is a SYMBOL font.  While there are known issues with displaying glyphs with SYMBOL fonts in Web pages and GUI controls like Rich Edit in Windows NT-based operating systems, that isn't (usually) the case with ANSI fonts.  Therefore, the recommendation is to use ANSI fonts when possible.

APL2000 Support

Reply to this Comment   

RE: APLPLUS font not displayed properly
By Ric.Sherlock on Thursday, August 26, 2004 (EST)
Thanks for the prompt reply! I'm still in the dark as to which one is the ANSI font (APLHELP is an ANSI font whereas APLHELP is a SYMBOL font). I'm just hoping that it is APLHELP! Whichever APLPLUS is, it seems to me that it is causing the most problems in this case!

Reply to this Comment   

RE: APLPLUS font not displayed properly
By Support on Thursday, August 26, 2004 (EST)

Ooops!  Thanks for pointing out my mistake.  Yes, APLHELP is ANSI and APLPLUS is SYMBOL.

APL2000 Support

Reply to this Comment   

Add Your Comment



APL2000 Official Web Site

The influence of each human being on others in this life is a kind of immortality.
--- John Quincy Adams

APLDN Home   |    |  Events   |  Trainings   |  APL Books   |  APLDN Links   |    |  Discussion Groups   |    |  Downloads   |  Articles   |  Library   |  Learning Tools   |  APLDN User IO   |  APL2000.com   |