InfoPath form - Namespace prefix 'tns' is not defined.

  • 17 January 2008
  • 10 replies
  • 31 views

Badge +8

I am trying to help some figure out what is going on.  They have an InfoPath form and when we try to add SmartObjects to it via the Intgeration Wizard or right clicking the .xsn we get this error "Namespace prefix 'tns' is not defined.".


Anyone have an idea why we would be getting this???


Thanks,
Jason


10 replies

Badge +8
Apparently the person I was helping contact K2 support, and they did something to it to fix it.  Wish I knew what they did...
Badge +7

I think I know how the guys at K2 remedied this problem. Rename the *.xsn file to *.cab to view the insides of your infopath form and open the xml (xsl) file(s) containing the definitions for data connections and fields.


 

you'll notice that there is a tns namespace, and probably a tns1 namespace.


 

The issue lies with SmartObject integration!


if you add a non K2 data connection first (e.g. a generic webservice or sharepoint library), InfoPath assigns this to the 'tns' namespace resulting in an error condition in the K2 wizard, however if you do your smartobject integration before adding any data connections you'll find that 'tns' gets assigned to a K2 smartobject namespace... and it'll be happy once more!


currently the K2 wizard only looks for 'tns' and if you've been unlucky enough to make use of this namespace yourself.... you will have this issue. I hear theres a fix in the next release of the product 


 

Hope this helps


 


Martin

Badge +8

Cool...


Over the weekend I ran into other errors with using custom data connections with web enabled forms.  Download the following KB hotfix to resolve the issue - K2 [blackpearl] Update KB000215.


Jason

Badge +2
Actually, I´m using that KB hotfix and i still get the problem.
Badge +7

K2 [blackpearl] Update KB000215 is not the fix for this issue (although in some cases it might have some sort of effect), K2 labs are currently working on a fix that will be available in the next release.


The issue lies with the use of the tns namespace in infopath. If you add your own external data source (e.g. SharePoint list, or webservice) before you do your SmartObject integration you'll find that you will get this error. This is because InfoPath will use the tns namespace for your data sources rather than the K2 smartobject integration.


You can see this for yourself if you rename your *.xsn file to *.cab (the extract it) and examine the xml files that this contains... you'll see the the tns namespace will be used by data sources other than K2 ones... the wizard cant handle the fact that it doesnt own the tns namespace.


 Martin

Badge

Hey Martin,


I was looking into the TNS thing. found ur post interesting. However i have one question:


How does InfoPath decide which namespace should be assigned first for data connections. I mean...if we add two data connection Cnctn1 and Cnctn2...One will use TNS and Another will use NS1.... right?


 So how does infopath determine which namespace to be assigned to which data connection.


Thanks,


Ved


 

Badge +4

Hello Martin, I am having the same issue and i was following your instructions but i don't know what to do with the tns/tns1 namespaces? do i delete them and this will fix the error?


Thank you

Badge

I'm also curious how to fix this issue. I file it under another EPIC K2 FAIL along with dozens of others. 50K down the drain, what a great investment :)


If it is a bug in the InfoPath wizard, where is the bug fix?

Badge +9

From what I understand, this is currently a known issue when you add a non-K2 data connection first to the InfoPath form (this should be fixed in a later release). The issue is that the InfoPath form assigns the 'tns' namespace to the non-K2 data connection which then causes the error as the K2 wizard is looking for this 'tns' namespace (which is already occupied by the other data connection).


To fix this, do the following (I got the steps from Dewald):



  1. BACKUP! your infopath form.
  2. Rename the for to *.cab(extension) from *.xsn
  3. Extract your infopath document files to a folder from the cab file.
  4. Open all the Xml and XSD files in Visual Studio by dragging the files into an open Visual Studio IDE.
  5. Use “Find in Files” and search for the “tns” namespace and replace with tsnX or something unique. Replace all instances of tns with tnsX. Be careful not to replace tns1, tns2 or any other namespace. </tsn: ... >
  6. Repeat step 3 and search for “tns1” or the namespace currently assigned to the SmartObject Integration and replace this with tns.
  7. Use CABARC to re-cab the files into an cab file and rename back to XSN. Publish the IP Form and retry the implementation.

Hope this helps.  Cheers.

Badge

No need to create a CAB file - use "Save as source files" and it will unpack them automatically.


When you have finished going through changing the namespace prefixes as described, right-click the "manifest.xsf" file and select "design" then save it back over the Infopath template.

Reply