<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>**Solution Found** - InfoPath 2003 - How to call a MOSS Webservice using C# and pass in a parameter</title><link>https://www.infopathdev.com:443/forums/thread/41284.aspx</link><pubDate>Tue, 05 May 2009 13:19:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:41284</guid><dc:creator>yu217171</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/41284.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=41284</wfw:commentRss><description>&lt;p&gt;Hi everyone,&lt;/p&gt;
&lt;p&gt;I have been searching for a week&amp;nbsp;but cannot find a solution to my problem.&amp;nbsp; I am hoping that someone here can help me out.&lt;/p&gt;
&lt;p&gt;I have a MOSS webservice that I need to call (&lt;a href="http://moss/_vti_bin/usergroup.asmx"&gt;http://moss/_vti_bin/usergroup.asmx&lt;/a&gt;) and pass in a parameter (current username).&amp;nbsp; Then I would like to loop through the resultset and add the values to a drop-down list.&amp;nbsp; Can someone help me out with the code?&amp;nbsp; Thanks, much appreciated.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;yu217171&lt;/p&gt;
&lt;p&gt;**************************************&amp;nbsp;&lt;/p&gt;
&lt;p&gt;**Update: Code Below**&lt;/p&gt;
&lt;p&gt;Hi everyone,&lt;/p&gt;
&lt;p&gt;I have found how to dynamically query a web service passing in a dynamic parameter.&amp;nbsp; Here is the code below.&lt;/p&gt;
&lt;p&gt;&amp;lt;code&amp;gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;IXMLDOMDocument3 wsDOM =(IXMLDOMDocument3)thisXDocument.DataObjects[&amp;quot;DataConnectionName&amp;quot;].DOM;&lt;/p&gt;
&lt;p&gt;//Set the SelectionNamespaces so that you can find the correct field&lt;br /&gt;wsDOM.setProperty(&amp;quot;SelectionNamespaces&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;xmlns:dfs=\&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution/"&gt;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\&lt;/a&gt;&amp;quot;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + &amp;quot; xmlns:tns=\&amp;quot;&lt;a href="http://schemas.microsoft.com/sharepoint/soap/directory//"&gt;http://schemas.microsoft.com/sharepoint/soap/directory/\&lt;/a&gt;&amp;quot;&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;//thisXDocument.UI.Alert(wsDOM.xml); &amp;lt;-- I used this to get the soap envelope and the xpath to the parameters and to find out which namespaces to set.&lt;/p&gt;
&lt;p&gt;wsDOM.selectSingleNode(&amp;quot;/dfs:myFields/dfs:queryFields/tns:GetUserCollectionFromGroup/tns:groupName&amp;quot;).text = &amp;quot;ActionUsers&amp;quot;; &amp;lt;-- Put your variable here&lt;br /&gt;thisXDocument.DataObjects[&amp;quot;DataConnectionName&amp;quot;].Query(); &amp;lt;-- Call the Query method to execute the webservice call&lt;/p&gt;
&lt;p&gt;&amp;lt;/code&amp;gt;&lt;/p&gt;</description></item></channel></rss>