Communication Componentes and XML Ports

rkaufmannrkaufmann Member Posts: 71
Hi,

using Navision 4.0 (SP3) I'm trying to use a XML Port to directly export data to an Bus Adapter.

I use the following code:
IF ISCLEAR(ComCom) THEN
  CREATE(ComCom);

IF ISCLEAR(SocketBusAdapter) THEN
  CREATE(SocketBusAdapter);

ComCom.AddBusAdapter(SocketBusAdapter,0);
OutMsg := ComCom.CreateoutMessage('Sockets://localhost:7000');

OutStreamVar := OutMsg.GetStream;

XMLPORT.EXPORT(50000, OutStreamVar);

OutMsg.Send(0);

ComCom: Automation 'Navision Communication Component version 2'.CommunicationComponent
SocketBusAdapter: Automation 'Navision Socket Bus Adapter'.SocketBusAdapter
OutMsg: Automation 'Navision Communication Component version 2'.OutMessage
OutStreamVar: Outstram

When running the code, the Navision Client crashes and is closed.

I'm quite an new to XMLports and Com, so what is the problem with my code?

A receiving Socket exists. Sending a simple Text using
Outstream.write('Hello World')
is working.

Regards,
Rolf

Comments

  • fufikkfufikk Member Posts: 104
    Hi,

    I used quite similar code but with MSMQ to export some navi data.
    The only (maybe important) difference I see is:

    instead of:
    XMLPORT.EXPORT(50000, OutStreamVar);
    

    I use:
    XMLPORT.EXPORT(50000, OutStreamVar, Rec);
    

    where rec is a record variable xmlport runs on.

    Hope it helps,
  • rkaufmannrkaufmann Member Posts: 71
    Hi fufikk,

    I tried it with specifing a record variable, but the Nav Client still crashes.

    Thanks anyway,
    Rolf
  • fufikkfufikk Member Posts: 104
    Some time ago, I had a problem with NAS and automation object which used network communication. As long as both NAS and DB server were located on one computer everything was OK. When NAS was moved to separate computer it crashed ocasionally. I'm not sure if it applies in your case but I guess it was worth mentioning.
  • rkaufmannrkaufmann Member Posts: 71
    Hi,

    I currently just testing, and both "tasks" run on the same machine, using two instances of a navision client.
  • TSESDSTSESDS Member Posts: 14
    If the code crashes at XMLPort.EXPORT(50000, ...) then you could first try to export the data in a normal file (a "normal" stream). If this works, the XMLPort with ID 50000 seems to work properly. If not, you have to check the XMLPort itself.

    (Viel Glück!)
  • fufikkfufikk Member Posts: 104
    Checking the XMLPort is a v. good idea... if its not well designed NAV client may crash. Try to create a file variable, get its outstream and run XMLPort to that stream. If navi crashes then 100% its the XMLPort that's causing the problem.
  • todrotodro Member Posts: 117
    rkaufmann wrote:
    Hi,

    I currently just testing, and both "tasks" run on the same machine, using two instances of a navision client.
    Hi,

    do you run the two instances of the client from the same directory ? If so, they are sharing DLLs, try to run them from separate directories.
    Torsten
    MCP+I, MCSE NT, Navision MCT (2004,2005)
  • fwiedmannfwiedmann Member Posts: 1
    Hi,

    i had the same problem. But now I have the solution. :lol: When you set the property "Encoding" from the XMLPort to UTF-8 then it works.

    It think the Navision Application Server only knew this standard.

    I hope i could help you.
Sign In or Register to comment.