Navision Integration Framework

Miklos_HollenderMiklos_Hollender Member Posts: 1,598
I started to write a general framework for accessing Navision data from outside with firing triggers. You just drop something like this into MSMQ or, better yet, a web service:
<Modify RecordID = "Customer: Cust001" CallOnModify="True" RequestID="5FS4WG4WW-FW4TRWFWW3343-DWW343434-43W4WRW">
  <Field FieldNo="2" CallOnValidate = "True">Forrester Ltd.</Field>
  <Field FieldNo="5" CallOnValidate = "True">Baker street 23</Field>
</Modify>


and you have updated a record. And same stuff for inserting, reading etc. I will publish it when it is finished, but I have some problems.

1. How should I handle locking? I'd like to avoid a SingleInstance CodeUnit, because that keeps throwing internal errors (4.0SP1), but without that, what else could maintain a lock between a reading and a modifing request?

2. How should I route answering to requests? It seems the client application will need at least two threads, one of them collecting answers from MSMQ and saving them, the other thread - that initiated the requests - will wait and periodically search the answers for it's RequestID to find something like "Modify OK" to know the operations has finished successfully. Is there an easier way for it?

Comments

  • ara3nara3n Member Posts: 9,257
    This is a great idea, but you'll be reinventing the wheel. Nav 5 might do something like this and you'll be reinventing the wheel. Just wait a few weeks until we something about it.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SavatageSavatage Member Posts: 7,142
    maybe Mark will ask in detail at the tech ed 2006 meeting
  • kinekine Member Posts: 12,562
    1. How should I handle locking? I'd like to avoid a SingleInstance CodeUnit, because that keeps throwing internal errors (4.0SP1), but without that, what else could maintain a lock between a reading and a modifing request?

    Very hard... if you want to do more request in one transaction, you do not have another solution than collect the requests into some buffer and after zou know, that the transaction is prepared (you have something like EOT in the message queue) you need to process the buffer in one run.

    Which internal error do you mean? How you are calling this codeunit? If you call it from CU1, you need to check if the CU is defined as global or local.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    ara3n,

    I think we can safely assume that

    1) In Nav5 it will not be implemented in pure C/AL, but also the fin.exe will be extended, which means if it has errors, which are usually plenty, we will not be able to fix it

    2) it will cost extra money
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Well, the internal errors I got not only by NAS but running a s.i. CU in a client, because my first idea was to keep a RecRef in memory in a s.i. CU and send it "open", "validate", "insert" etc. messages through MSMQ.
  • kinekine Member Posts: 12,562
    Do not forget to security - if anyone will be allowed to send such a XML to your system, you have BIG security hole...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    It's almost done, now I only have to write a few examples. One of them should be PHP. I have the following problem with using COM components from PHP:
    $outMsg = $cc2->CreateoutMessage('Message queue://');
    $outStream = $outMsg->GetStream();
    $outStream->WRITE($xml);
    

    Basically, the problem is that while PHP properly instantiates the OutMessage COM object returned by CreateoutMessage into $outMsg, it does not instantiate the COM OutStream object returned by GetStream(); into $outStream. $outStream becomes a zval (a generic, undefined PHP type) instead, and as it of course does not have a WRITE method, it fails.


    Fatal error: Call to a member function WRITE() on a non-object.
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Amazing. In Ruby, it's even worse, even CreateoutMessage does not return a COM object. There must be something deeply wrong with the implementation of COM in dynamic languages. I think we'll have to stick to .NET for this one. I hope at least the .NET-COM interop works properly.
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    BETA version just submitted, I think it will be available in the downloads soon. Please help me figuring out how to use it in PHP.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Savatage wrote:
    maybe Mark will ask in detail at the tech ed 2006 meeting

    Be patient Miklos for nav 5.0. :mrgreen:
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Yeah. And what if that becomes the same quality as Employee Portal? It is Open Source, therefore here you can repair bugs... that one will be hardcoded into fin.exe I think.

    Besides, I don't think they would explicitly make it easier to send in data from non-MS languages, it's not their style, isn't it?
  • themavethemave Member Posts: 1,058
    Savatage wrote:
    maybe Mark will ask in detail at the tech ed 2006 meeting

    Be patient Miklos for nav 5.0. :mrgreen:
    Isn't a working version of nav 5.0 (ie nav 5.0 sp2) not due for a year or so ?
  • ara3nara3n Member Posts: 9,257
    If sp2 for v5 will be that long away, it means 5.0 will be in great quality that you can use for a year.




    :whistle:
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • themavethemave Member Posts: 1,058
    ara3n wrote:
    If sp2 for v5 will be that long away, it means 5.0 will be in great quality that you can use for a year.




    :whistle:
    What I am concerned about, is the cost to upgrade to 5.0 will be very large,so you should probably wait for SP1 before you upgrade, but with how fast SP2came out after SP1 for version 4. then you should probably expect to just wait for SP2 for Na 5.0 before you upgrade.

    Because if you go to NAV 5.0 before any service packs, you will likely face a huge cost once SP1 and then again once SP2 comes out to upgrade your NAv5.0 database. :wink: Don't you think, each upgrade for a sp1 to have an NSC do it for an end user will not be cheap. if you have anything but an unmodified version of Navision, which of coarse nobody has an unmodified version of Navision. :lol:
Sign In or Register to comment.