The Navision Socket Bus Adapter - Sending a Document

In this example, we use a codeunit to initialize the Navision Communication Component, establish contact to the Navision Socket Bus Adapter, open a socket server for the bus adapter and send the message.

For the purpose of this example, we have defined the following variables:

Variable Name

Data Type

Subtype

Length

CC2

Automation

'Navision Communication Component version 2'.CommunicationComponent

 

SBA

Automation

'Navision Socket Bus Adapter'.SocketBusAdapter

 

OutMsg

Automation

'Navision Communication Component version 2'.OutMessage

 

OutS

OutStream

 

 

The socket server uses port 8079 on the local machine.

Example

OnRun()

  IF ISCLEAR(CC2) THEN
    CREATE(CC2);
  IF ISCLEAR(SBA) THEN
    CREATE(SBA);

  CC2.AddBusAdapter(SBA, 0);
  OutMsg:= CC2.CreateoutMessage('Sockets://localhost:8079');

  OutS:= OutMsg.GetStream();
  OutS.WRITE('First Text');
  OutS.WRITE('Second Text');
  OutS.WRITE('Third Text');

  OutMsg.Send(0);

More information:

Navision Socket Bus Adapter

Navision Socket Bus Adapter: Setting Up Interfaces