Hi,
I'm trying to create an solution which allows client applications using my webserivce enter some data to Navision. I've decided to use sockets.
So in general it works (or should) like this client app sends request to webservice, it connects to navision, sends data, gets response and forwards it to the client. The webservice is written in .net c#.
the navision code unit looks like this (singleinstance=yes):
cc2 = navision comunication component
inxml = microsoft xml 3.0
OnRun()
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(SBA) THEN
CREATE(SBA);
CC2.AddBusAdapter(SBA, 0);
SBA.OpenSocket(8079, '');
CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
InMsg:= InMessage;
CREATE(inxml);
InS := InMsg.GetStream();
inxml.load(InS);
DoSomeStuff.SetParam(inxml);
result := DoSomeStuff.RUN;
IF InMsg.ExpectReply THEN
BEGIN
OutMsg := InMsg.CreateReply();
OutS := OutMsg.GetStream();
IF result THEN
OutS.WRITE('Y')
ELSE
OutS.WRITE('N');
OutMsg.Send(0);
END;
InMsg.CommitMessage();
and now the strange part:
Regular win application (c#), which connects to the navision socket directly works great. (app<->navision)
The same piece of code put into webservice, which is then consumed from another application sends data but fails on receiving. (app<->webservice<->navision)
the code for socket connection in .net looks like this:
TcpClient tcp = new TcpClient("it006nb", 8079);
NetworkStream nw = tcp.GetStream();
StreamWriter sw = new StreamWriter(nw);
StreamReader sr = new StreamReader(nw);
sw.Write("<somexmldata>");
sw.Flush();
String d = sr.ReadLine();
sr.Close();
sw.Close();
tcp.Close()
Anyone ever had this or similar problem? pls help
Comments
RIS Plus, LLC
I'll post some news as soon as I get it done.
Thanks for reply O:)
I ran one test to see how efficient this solution could be. The test environment looked like this:
client application passed data to my webservice, which connected to my serwer component, which inserted data into navision tables.
The data was something like a sales order: header and 2 lines. The webservice build an XmlDomDocument object from client's data and passed it to navision. Navision inserted data into header table and row table and returned a XmlDomDocument with response, which was forwarded to the client app.
I ran it in a loop which inserted 1000 orders. The total time of this operation was about 4 minutes.
Keep in mind that my computer (1,6mobile celeron, 521MB ram) was running client application, IIS (for webservice), NAS (8000Kb cache), Navision Database Server (20000KB cache) and some other apps (outlook, skype, etc).
I'm curious if any one has ever tried something similar with MSMQ.
Anyway, I think that if such solution is placed on real server machine, the performance would be much, much greater.
RIS Plus, LLC
RIS Plus, LLC
We have to develop a similar scenario: many clients must request the Navision Application Server at the same time. We also want to use the Socket Bus Adapter to talk with Navision. Our current problem ist that our XML-requests have different length so it's difficult for us/the SBA to recognize the end of each request. Would you have a solution to this when using the Navision SBA? If not, we also plan to develop our own COM-object to act as a server for a socket communication. The Navision SBA seems to be very robust. The main problem with an own bus adapter is in our opinion the robustness. What if it goes down - you're in a single-instance codeunit and have no chance to re-initialize your COM-component? What experiences do you have with your own socket bus adapter?
Thanks in advance.