Problem with Navision Communication Component

KWAKWA Member Posts: 5
edited 2006-11-10 in Navision Attain
Hi Folks,

I have the following problem with the ComCom Component.
What you see bellow are code snippets from the gComCom2::MessageReceived function which is automaticly created when you use a variable of type Automation subtype 'Navision Communication Component version 2'.CommunicationComponent.

When I try to save an XMLDoc (gXmlDocRes) of about 500KB to the OutStream (locOutStreamRes) like this:

    locIOutMessageRes := locIInMessageReq.CreateReply; locOutStreamRes := locIOutMessageRes.GetStream; gXmlDocRes.save(locOutStreamRes); IF NOT ISCLEAR(locIOutMessageRes) THEN BEGIN //Send
WITHOUT getting back the return value
locIOutMessageRes.Send(0);
END;


an error cames up in Attain, which says: "The stream has returned a write error" which is followed by another error : "This message is for C/AL programmers: The call to member send failed. SocketBusAdapter.1 returned Socket error."
If I use the same method with getting back the return value (see code bellow) It seems to work:

    locIOutMessageRes := locIInMessageReq.CreateReply; locOutStreamRes := locIOutMessageRes.GetStream; gXmlDocRes.save(locOutStreamRes); IF NOT ISCLEAR(locIOutMessageRes) THEN BEGIN //Send
WITH getting back the return value
IF NOT locIOutMessageRes.Send(0) THEN
MESSAGE('Looks like .Send error');
END;


But .... and thats my problem, it doesn´t work every time. And it seems to have some relation to the filesize (cause there are no problems with small files). But I don´t understand why the OutStream can be succesfully filled with the same XML Doc 2 of 3 times. That would mean that it has nothin' to do with the size of the Xml Doc.

Does anyone here have experience with this ????


Regards KWA

Comments

  • eromeineromein Member Posts: 589
    Can you tell us what you are trying to do? Why do you need this?
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • KWAKWA Member Posts: 5
    We build a communication between different systems and data exchange works with tcp sockets.

    For example: SystemA(NON Navision) needs some data from SystemB(Navision).

    SystemA sends a defined XML Request to SystemB where the NAS has started a codeunit which has opened a tcp socket. When message is recieved, SystemB creates a Response XML with requested data and sends it back to SystemA on the opened socket.

    Thats what we use it for. It worked fine until we implemented a method which give back a bunch of CustomerNo. (there can be much of them as you know).

    And now I´ve try to fix this error cause like I wrote before it works not everytime and this is not the kind of clean communication we are looking for :)
  • eromeineromein Member Posts: 589
    Sounds like your file is to big, as you wrote before.

    It is a standard windows component? It's there something about it on the Knowledge base of M$?

    http://support.microsoft.com/default.aspx?scid=fh;EN-US;KBHOWTO
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • KWAKWA Member Posts: 5
    well, exactly that is the problem if the file were to big it would not work at all, but it works from time to time :?
  • chrmuellerchrmueller Member Posts: 9
    I think the client is the problem... If you use this code everything is written to the stream:

    xmldoc.save(outstream);

    to avoid problems on the other side use this code to read the stream:

    while not instream.eos
    begin
    xmldoc.load(instream);
    end;

    Regards
    Christian
  • ronvdwronvdw Member Posts: 16
    I've had the same problem with the Communication Component. The problem is that the Stream error occurs occasionaly and this makes an interface with the Communication Component unreliable. I have logged a case at the MBS support site.

    I have replicated this problem:
    1. made a codeunit which acts as a server (with the socket bus adapter)
    2. made another codeunit which sends messages to the server (this CU runs in a different client)
    3. If I send 100 messages (in a FOR loop) the server crashes.
    Connectivity Studio for Microsoft Dynamics NAV - Where Microsoft Dynamics NAV meets the world
  • TSESDSTSESDS Member Posts: 14
    KWA wrote:
    We build a communication between different systems and data exchange works with tcp sockets.

    For example: SystemA(NON Navision) needs some data from SystemB(Navision).

    SystemA sends a defined XML Request to SystemB where the NAS has started a codeunit which has opened a tcp socket. When message is recieved, SystemB creates a Response XML with requested data and sends it back to SystemA on the opened socket.

    Thats what we use it for. It worked fine until we implemented a method which give back a bunch of CustomerNo. (there can be much of them as you know).

    And now I´ve try to fix this error cause like I wrote before it works not everytime and this is not the kind of clean communication we are looking for :)

    I have a similar requirement: I've lots of clients, which sends requests (as xml-data) to an tcp/ip-socket with a fixed port number, which is listened by a socket bus adapter instance. The request can have several formats and different lengths. My first problem is to "recognize" the end of the request in the bus adapter. Since I've no fixed-size request, I cannot use the BytesToRead-property. How do you stop the receiving process? The second problem is when several clients do their requests in parallel. I hope that this will be possible. Do you have experiences about the behaviour when multiple requests come in at the same time?

    Thanks a lot for your answer!
Sign In or Register to comment.