NAV 2009 Web Services, gestione del rollback

Ciao a tutti, ho fatto un pò di prove con i web services di 2009 e in tutti i test che ho fatto gli errori del sistema vengono passati in modo trasparente al Web Service: vengono restituiti gli esatti messaggi di errore sia tramite i metodi standard delle page sia con le codeunit custom pubblicate e fin qui tutto bene.

Gestione del rollback

Avrei una domanda relativa alla gestione del rollback con i Web Services NAV 2009 (es: creazione testata\righe ordine tramite Web Service richiamando le funzioni pubblicate nel web service nel mio caso basato su page)

→ non sono riuscito a fare in modo che non venga incrementato il numero di serie degli ordini in caso di errore: in pratica se l’ordine va in errore su una qualsiasi riga (ad esempio per articolo bloccato, blocco cliente bloccato etc.) non riesco a fare in modo che non venga staccata una testata d’ordine vuota; questo utilizzando i metodi standard di NAV 2009.

Come posso gestire questa transazione col web service per gestire il rollback delle testate?

Grazie per il supporto.

Ciao.

ho trovato feedback su altro forum da ara3n, David Singleton,kriki per lo stesso post inserito da un mio collega (l’abbiamo messo 2 volte per capire in quale si risponde prima)

liks risposte che riassumo

http://www.mibuso.com/forum/viewtopic.php?f=32&t=39627&start=0&sid=ef63af836269757097fd8f4913360b32

1a ipotesi

  1. webservice NAV2009 (the original without hotfix) has a bug: the COMMIT command does NOT do a COMMIT!

  2. otherwise : search where the COMMIT is, and do a test:

IF NOT ISSERVICETIER THEN
COMMIT;

The problem is: you have to find all COMMIT. And if later on, someone adds a commit,…

2a ipotesi
Is one transaction and it is being called twice, hence two transactions.

These are the options.

  1. Delete the any records created if you get any error. (rollback manuale)

  2. Write the data into staging table and call a NAV function to create the orders and if errors out to delete the data from staging table.

  3. Create a codeunit with a function and pass XMLport as paramter. I haven’t tried this yet. → come per la versione precedente per NAV 5.0

  4. Write the data into staging table and call a NAV function to create the SO and if errors out to delete the data from staging table.

→ This is what I would suggest also. Though I would not delete the data if there is an error, I would add a status field and mark the order as failed, this gives you an audit trail and lets the user check what went wrong, Then once resolved, flush out the old data.

se avete altre idee. grazie.