Problem with Navision Communication Component

KWA
Member Posts: 5
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.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:
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
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
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
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
0
Comments
-
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."0 -
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 for0 -
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."0 -
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 :?0
-
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
Christian0 -
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 world0 -
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!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions