<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Web Services</title><link>https://www.infopathdev.com:443/forums/48.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Passing a parameter to a web service</title><link>https://www.infopathdev.com:443/forums/thread/17764.aspx</link><pubDate>Fri, 02 Jun 2006 14:34:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17764</guid><dc:creator>JeffK627</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17764.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=48&amp;PostID=17764</wfw:commentRss><description>I am trying to pass the contents of a text box as a parameter to a webservice.  I tried using betazed's code - adapted to C# - with the appropriate names plugged in for the Data Object and parameter, but it throws a nullReferenceException.  I have nailed down the exception to the left side of the assignment, specifically where it tries to assign a value to query.text.  It seems that as far as the code is concerned, "query" is null and you can't assign to null because it's not an instance of an object and that's that.&lt;br /&gt;&lt;br /&gt;My actual code is as follows:&lt;br /&gt;&lt;br /&gt;        &lt;pre&gt;private void RequeryWebService()&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                //Get a reference to the Web Service &lt;br /&gt;                DataObject wsGLE = thisXDocument.DataObjects["getLEArray"];&lt;br /&gt;&lt;br /&gt;                //Get a reference to the Web Service's DOM &lt;br /&gt;                IXMLDOMDocument3 wsDOM = (IXMLDOMDocument3)wsGLE.DOM;&lt;br /&gt;&lt;br /&gt;                //Set the SelectionNamespaces so that you can find the correct field&lt;br /&gt;                wsDOM.setProperty("SelectionNamespaces", &lt;br /&gt;		            "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\"" &lt;br /&gt;		            + " xmlns:tns=\"http://tempuri.org/\"");&lt;br /&gt;&lt;br /&gt;                //Set Web Service parameters&lt;br /&gt;                IXMLDOMNode aNode = wsDOM.selectSingleNode("/dfs:myFields/dfs:queryFields/tns:getLEArray/tns:userInput");&lt;br /&gt;                aNode.text = thisXDocument.DOM.selectSingleNode("/my:myFields/my:wsParam1").text;&lt;br /&gt;&lt;br /&gt;            //Requery the webservice datasource&lt;br /&gt;            wsGLE.Query();&lt;br /&gt;            }&lt;br /&gt;            catch(Exception e) &lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine(e);&lt;br /&gt;            }&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I would be grateful for any help!</description></item><item><title>Re: Passing a parameter to a web service</title><link>https://www.infopathdev.com:443/forums/thread/17763.aspx</link><pubDate>Sat, 05 Nov 2005 22:00:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17763</guid><dc:creator>betazed</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17763.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=48&amp;PostID=17763</wfw:commentRss><description>Got it :)&lt;br /&gt;&lt;br /&gt;Just add the lines below&lt;br /&gt;var query = oDataObject.DOM.selectSingleNode('/dfs:myFields/dfs:queryFields/tns:MyDataObject/tns:myParam);&lt;br /&gt;query.text = myValue;</description></item><item><title>Passing a parameter to a web service</title><link>https://www.infopathdev.com:443/forums/thread/17496.aspx</link><pubDate>Sat, 05 Nov 2005 21:42:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17496</guid><dc:creator>betazed</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17496.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=48&amp;PostID=17496</wfw:commentRss><description>I am trying to pass a parameter to a web service using XDocument.DataObjects &lt;br /&gt;var node = getNodeValue("/TestDoc/MyNode");&lt;br /&gt;var oDataObject = XDocument.DataObjects.Item("MyDataObject");&lt;br /&gt;oDataObject.DOM.setProperty( "SelectionNamespaces",  'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" '  'xmlns:tns="http://tempuri.org/"');		&lt;br /&gt;var oQueryAdapter = oDataObject.QueryAdapter;&lt;br /&gt;// I need to set a parameter here.&lt;br /&gt;oQueryAdapter .Query();&lt;br /&gt;&lt;br /&gt;My web service takes in one input parameter. I need to set this parameter using code prior to querying the web service. This seems to be easily possible in an ADODataAdapter using the Command property but I cant figure out how to do this for a WebServiceAdapter&lt;br /&gt;&lt;br /&gt;Any help would be greatly appreciated.</description></item></channel></rss>