Exceeds the size of the string buffer - sending XML via TCP

drstakzdrstakz Member Posts: 30
Hello everybody,
pls can you help me?
I created codeunit for sending xml to my other application (.NET). With smaller xml i haven't problem, communication is OK. But if I try send larger xml, NAV return error "The length of the string exceeds the size of the string buffer".

For communication i used navision communication component 2 (CC2) and Navision Socket Bus Adapter (SBA). Other variable are OutMsg : CC2.Outmessage, OutS : OutStream, xmlout : XmlDocument


my code:
  IF ISCLEAR(CC2) THEN
    CREATE(CC2);
  IF ISCLEAR(xmlout) THEN
    CREATE(xmlout);
  IF ISCLEAR(SBA) THEN
    CREATE(SBA);

  CC2.AddBusAdapter(SBA, 0);
  xmlout.load(FORMAT('C:\temp\c.xml')); // load large xml
  OutMsg:= CC2.CreateoutMessage('Sockets://192.168.1.1:3000');
  OutS:= OutMsg.GetStream();
  OutS.WRITE(xmlout.xml); // here is problem with xml size
  OutMsg.Send(0);

Some idea, pls?? Is it possible send xml document direct to CC2.OutMessage without normal outstream ?? or? ..

Very thanks for help

Comments

  • drstakzdrstakz Member Posts: 30
    So OK,
    small change was necessary.
    xmlout.save(OutS);
    

    instead OutS.WRITE(xmlout.xml);
  • ppavukppavuk Member Posts: 334
    NAV texbuffer before NAV2013 was 1024. When you passing your xml as string to your automation it hit the text buffer which causing error (the same will be with variant datatype). You need to find a way how to pass your xml to your automation not using text buffer.

    You could look to ADO Stream, but not sure - never used CC2... What else metods got your automation? What datatypes it can accept?
Sign In or Register to comment.