Unfortunately, InfoPath is not able to directly consume a Web Service that returns an ADO.NET DataSet. InfoPath is designed to handle generic XML payloads. By default, a DataSet that is returned by a Web Service is a serialized XML string that returns a format that InfoPath is not able to directly consume.
If you are like me, I use the DataSet as the base for everything I do around data access. I developed this little helper function that I use to convert a DataSet to an XML Document that InfoPath is able to understand.
<WebMethod()> Public Function InfoPathGetRequests(ByVal RequestedStatus
As Boolean) As System.Xml.XmlDataDocument
' this is a wrapper service for conversion of the DataSet for use
' in an InfoPath form
Dim requestds As DataSet
' call the Web Service to get the DataSet
requestds = GetRequests(RequestedStatus:=RequestedStatus)
' create the XML Document
requestds.Namespace = "Http://localhost/RequestType"
Dim Info As System.Xml.XmlDataDocument = New _
System.Xml.XmlDataDocument(requestds)
Return Info
End Function
I then point my InfoPath form at this Web Service function and off it goes!
9:31:37 PM
|