Open a form saved via a web service

D

Daniel

Hi all,

I have created a web service that saves an InfoPath form to a SharePoint
forms server. Everything works fine except for when a form has a date field
on it, the web service saves it successfully to the forms server however the
saved form won’t open, receiving a “Schema validation found non-datatype
errors:†error.

The web service just takes the form xml and using SharePoints object model
saves it into the form library. I call this web service from InfoPath when
the form is submitted.

After more testing I found that if I change the date fields in the form
template to strings, and publish the form I can open the previously saved
forms that were receiving the error, but any new forms created off this
template do not open.

Does anyone have any suggestions to help me troubleshoot this issue?
 
S

S.Y.M. Wong-A-Ton

From within SharePoint, right-click on one of your forms, and save it
locally. Then browse to the form, right-click on it, and open it with
Notepad. Locate your date field and check what the format of the date is that
has been saved. Perhaps SharePoint or your web service has modified the date
to an unrecognizable format for InfoPath.
 
D

Daniel

Thanks for your reply.

I have already checked through the XML saved in the form and there is
nothing that looks wrong.

If I save the infopath form back to SharePoint using InfoPath's save button
and then use my webservice to save the same infopath form to the form libary
the only difference between the two xml documents are,
the one saved with infopath has <?xml version="1.0" encoding="utf-8"?>
and the one saved with my webservice has <?xml version="1.0"?>


What doesnt make sense to me is if I publish a new template the old froms
work but any newly saved forms do not.


Cheers

Dan.
 
S

S.Y.M. Wong-A-Ton

Then the only other thing I can think of is that the code you're using to
save the forms is corrupting something in the forms. What code are you using
in the web service to save the forms?
 
D

Daniel

Thanks for your help. Sorry I have been slow to reply, i have been away for
the past day.


The WebService just takes the Forms XML and adds it to the libary.

SPSite site = new SPSite(vSite);
SPWeb web = site.OpenWeb(vWeb);
web.AllowUnsafeUpdates = true;

SPList list = web.GetList(vListURL);

XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(xmlConents);

MemoryStream memoryStream = new MemoryStream();
xmlDocument.Save(memoryStream);

SPFolder fldr = web.GetFolder(vListName);
SPFileCollection files = fldr.Files;

SPFile spAdded = files.Add(vFileName, memoryStream, true);
files = fldr.Files;

SPItem ListItem = list.Items[spAdded.UniqueId];

ListItem["Submitted"] = "Yes";
ListItem["Template Link"] = vTemplateURL;

ListItem.Update();


I will try the suggestion in the link you provided. Hopefully thats all the
issue is.

Thanks again for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top