I'm trying to se code to call and retieve data from web services, and I'm having the same problem with null values being passed.
WebServiceConnection webservConn = (WebServiceConnection)DataConnections["dataConnectionName"];
XmlDocument inputDoc = new XmlDocument();
inputDoc.LoadXml("<EmployeeGetbyUserId xmlns=\"<webserviceurl>>" + User.UserName.ToString() + "</sUserId></EmployeeGetbyUserId>");
XPathNavigator inputNav = inputDoc.CreateNavigator();
XmlDocument outputDoc = new XmlDocument();
XPathNavigator outputNav = outputDoc.CreateNavigator();
XmlDocument errorDoc = new XmlDocument();
XPathNavigator errorNav = errorDoc.CreateNavigator();
webservConn.Execute(inputNav, outputNav, errorNav);
Not sure if this is supposed to automatically populate the data connection fields in the form but they are blank when accessed.
I'm using pretty much the same code to submit the retrieved data to another web service and the values are also received as null by the webservice.
Is this an incorrect approach to using web services programmatically in infopath or am I misunderstanding the XML code i'm passing into the execution?
I'm using the programmatic approach because I want to poll windows for the username before I call the web service, but still on Load (the data connection wizard only allows a static value to be passed)