Hi,
After 2 weeks of waiting with my question on 5 forums, not a bad result... (only 1 response on devx) - was my problem too hard?
Of course I could not wait so far with my problem, so I solved it. To keep discussion alive, I am responding to myself - with soem new questions, of course.
My initial problem seemed to be very simple and popular.
I have to pass several records from database to client, let client to change their content, send them back to server and update database.
My design was to use technique like this one, described in MSDN article:
http://msdn.microsoft.com/library/d...mwebservice.asp
but with client part of the application and code implemented on the thin client inside IE browser and using JavaScript and webservice.htc.
Unfortunately, DataSet's are not implemented in JavaScript, so with some anxiety I implemented my WebMethod GetDataSet() As DataSet returning DataSet. Then I realized that on client side - in callback function passed to my webservice.htc - variable that keeps returned DataSet becomes legal IXMLDOMElement containing DataSet implicitly exported to DiffGram format.
So I was happy, designing to complete my scenario like this:
- gathering data values from client controls in JavaScript code;
- comparing them one by one with DiffGram content and store them to DiffGram representation using DiffGram rules for marking added and updated records, keeping old values in <diffgr:before> section;
- pass changed DiffGram via webservice.htc as an argument to my WebMethod UpdateDataSet(data As DataSet).
I did not wanted to implement client part of complicated code (working with DiffGram) without checking that it works. So in my GetDataSet() function, I made some changes to records in my dataset programmatically. While debugging client code I realized that the changes were legally transferred to client, stored in DiffGram representation. Passing DiffGram back to UpdateDataSet() worked, too; so I wrote the server part of consuming DataSet and updating database according to my initial design.
Unfortunately, after implementing JavaScript code that stores client changes from client HTML controls to DiffGram in the same legal DiffGram format, the SOAP code on the server that tried to convert DiffGram to DataSet responded with error 'table name not found in target DataSet', although my DiffGram looked (I debugged and compared them) exactly the same as in first part of my experiment, when it was actually modified on the server, passed to client as modified, and returned back with no problem.
This is my current question number one: why SOAP converion of client DiffGram to server DataSet fails if the DiffGram is modified on the client using JavaScript code? For me, it seems to be Microsoft bug in SOAP implementation of implicit conversion.
Having to implement my code, and willing to do this with DataSet power, I changed my UpdateDataSet() function to UpdateDiffGram(diff as XmlElement), converting diff passed as argument to ds As New DataSet() using
ds.ReadXml(New XmlNodeReader(diff), XmlReadMode.DiffGram)
explicitly. I can assure that this code finally works, so I think my problem is solved.
However, it was not so straightforward due to some stupid question (may be I do not understand something in WebService philosophy of passing objects via SOAP protocol).
When I pass DiffGram from client as an argument to WebService function, it becomes on the server side stripped from top-most element, exposing only its innerXml.
So my second question is: why I have to wrap up my diffgram in additional covering tag to pass it safely to server where the wrapping tag becomes implicitly stripped?
And my third question is: why Microsoft constructs with DataSet - that should work like a snap - does not work?
And my fourth question is: why VS.NET is so server-centric, so I have to implement handling DiffGram in JavaScript manually? Have you heard of any JavaScript-based implementations of DataSet functionality that would be ready-to-use? For my point of view, architecture of website with static HTML pages (or generated on server via ASPX code) and with data interchange using power of WebService, is ideal. But it does not seems to be completed. The missed chain is the JavaScript DataSet implementation.
__________________
kff
kff