Saturday, October 21, 2006

Missing nodes from a webservice.

InfoPath is very particular about the type of document it processes - this due to its very stringent implementation of XSD Schemas. InfoPath will complain immediately if it encounters nodes that do not fit the schema design (nodes not defined in schema, nodes out of position, multiple nodes where not defined as repeating)

If a node is missing from the instance document and the schema dictates the optional presence of this node, InfoPath will accept the document as valid. However, if there are any controls being bound to the missing field, InfoPath will disable the field in the UI, as nothing can be written to a missing node.

This became painfully apparent in our early iterations of our InfoPath form. We noticed several fields being locked out in the form only to discover the fields were missing from the XML documents returned by our Webservice. We tracked this down to the Enterprise Library's Database Datatable to XML conversion.

Any null values in a recordset are not converted to empty fields in the resulting XML, but rather they are just omitted. Our solution was to use the schema to build ourselves an empty instance document and populate it with the data from the recordset. This way we are guaranteed to get all required nodes returned from a webservice

Since a schema document is simply another XML document, parse the XSD document and programmatically build the instance document starting from the root node element definition.. TBC

Friday, October 13, 2006

Extracting form files
  1. Choose Extract Form Files from the File menu.
  2. Select a location to save your extracted form files to, and then click OK.
  3. Close InfoPath to release the lock it places on your form files.
  4. Using a text editor, open your view .xsl file.

Friday, October 13, 2006


Breaking In A New Horse

One of the growing pains I encountered after migrating to Visual Studio 2005, was an issue I had trying to debug my InfoPath 2003 project. I would get an error message;
"In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project."

While VS 2003 would launch the InfoPath form and Debug it with a fancy-free click of the 'Debu' button, VS 2005 requires you to have the solution selected before it will attempt to launch the form.

However that brought me to an issue I was not previously having. Without having changed any code, the form failed to load in preview or debug mode. Now I am getting the “The format of the file .dll is invalid” error. You would see this error on our dev-test VPCs that did not have the .NET 2.0 framework installed prior to launching the new form.

How is it possible that the DEV workstation compiling the formcode.cs in Visual Studio 2005 .NET 2.0 did not have .Net 2.0 installed?!?

After a quick reinstall of the framework and a restart, the form is debugging and previewing again.

So in recap; select the solution item in the Solution Explorer of Visual Studio 2005 BEFORE attempting to debug (F5).

Ciao for Niao

Thursday, October 12, 2006

The project I'm currently working on finally afforded the time to convert the project from 2003 platforms to 2005 servers and .NET 2.0. While many of my collegues in other companies made the change last year, we are a consulting firm doing work for clients and so we required approval from the customer to proceed.

So far the InfoPath conversion was rather painless as we are not migrating to Office 2007 (yet?). The managed code compiled beautifully in Visual Studio 2005 and after installing the .Net 2.0 Framework on the test workstations, the form opened without flaw. However the webservices needed to be migrated to another machine name to not conflict with Sharepoint Services which are still running 1.1.4.

Our form displays a simple windows form with a rotating graphic scheme as a “Please Wait” message. Initially, a couple of them got stuck on the display and new ones stop showing up. Not sure what the cause was, but it seems to have corrected itself - perhaps the first load of the new form in .NET 2.0?

Other than that things went very well from my end. Next on the migration for me is Notification Services. Another breeze I expect.

Ciao for Niao