I created a SOAP webservice to use in infopath form and added the method which returns a data table as return type. When i try to add the dataconnection the method it gives me an error stating that "The selecetd XML document can not be used a data connection source because it includes inline XDR schemas". Here is the webmethod i wrote. it works well run it in the browser.
[WebMethod]
public DataTable GetApplications()
{
DataTable dt;
using (SPSite mysite = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb myweb = mysite.OpenWeb())
{
SPSiteDataQuery query = new SPSiteDataQuery();
query.Lists = "<Lists ServerTemplate=\"115\" />";
query.ViewFields = "<FieldRef Name=\"Applicant File Number\" Nullable=\"TRUE\" Type=\"Text\" />" +
"<FieldRef Name=\"Application Category \" Nullable=\"TRUE\" Type=\"Text\"/>" +
"<FieldRef Name=\"Application Type \" Nullable=\"TRUE\" Type=\"Text\"/>" +
"<FieldRef Name=\"Submission ID \" Nullable=\"TRUE\" Type=\"Text\"/>";
query.Query = "<OrderBy>" +
"<FieldRef Name=\"Submission ID\" />" +
"</OrderBy>";
query.Webs = "<Webs Scope=\"SiteCollection\" />";
dt= myweb.GetSiteData(query);
dt.TableName = "myApplications";
return dt;
}
}
}
Added the data table to a dataset and returned the dataset to infopath form through dataconnection. It worked well.