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
If it was hard to write, it should be hard to understand."
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
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
If it was hard to write, it should be hard to understand."
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
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.
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!