InfoPath Data Connection Wizard: Web Service Sample Parameter Error
I came across an issue in an InfoPath (2007) form where I was unable to configure a secondary data connection to the GetListItems web Service on a SharePoint site. The error message suggested that the xml data passed as sample parameters to the web service was not valid.
Soap error:
Element of parameter query is missing or invalid
After doing a bit of a search, I found that the issue related to character encoding of the sample XML string data passed to parameters, which is encoded in a way that makes the XML invalid when attempting to execute the query. It seemed that others were abandoning the Data Connection Wizard to configure a connection to SharePoint and using a “proxy web service”, or managed code as an alternative solution/workaround.
The following article provides a solution where the web service is configured and called using managed code from the form template, and by including the Web Service in the form as a web reference. This is referred to by some as a “Proxy Web Service” of the Lists Web Service in SharePoint (another InfoPath Data Connection Wizard alternative), and is the solution that I used.
http://wssdev.blogspot.com/2007/06/infopath-use-sharepoint-web-services.html
I created the ‘proxy web service' using an instance of the Lists web service in the code behind the InfoPath Form. This allows the query to be generated and passed to the appropriate parameters if the GetListItems web service using via the form's managed code, allowing XML to be included as the value for certain parameters (query, queryOptions, viewFields, etc).
Further information about configuring Web Service Data Connections in InfoPath:
The following thread explains the same scenario, and provides a managed code solution (Data Connection Wizard workaround).
http://social.msdn.microsoft.com/forums/en-US/sharepointinfopath/thread/bf10d50b-531c-4277-a1da-55f48428600d/
Create Web Service Data Connection using the Data Connection Wizard
http://office.microsoft.com/en-us/infopath-help/submit-form-data-to-a-web-service-HA010107048.aspx
Programmatically send parameters to SharePoint Web Service
http://www.delphi-ts.com/blogs/lozzi/post/2009/04/16/Programmatically-Send-Parameters-to-a-Web-Service-in-InfoPath.aspx
Submit a review:
Login required.