<?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>Format of value to be passed to a Web Service</title><link>https://www.infopathdev.com:443/forums/thread/98563.aspx</link><pubDate>Mon, 04 Aug 2014 17:36:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:98563</guid><dc:creator>cputnamnc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/98563.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=98563</wfw:commentRss><description>&lt;p&gt;I am using Infopath 2010, Word 2010, Sharepoint 2010, and VB in the Infopath code.&amp;nbsp; (This all ties together because we have a&amp;nbsp;document library in Sharepoint using a Word document template that has a Document Information Panel (DIP/Infopath form) where users can enter data that is then&amp;nbsp;automatically inserted into the&amp;nbsp;Word document and the Sharepoint document library.)&lt;/p&gt;&lt;p&gt;The code I am using in the DIP/Infopath form is&amp;nbsp;supposed to capture the value that a user types into a form, pass that value to a&amp;nbsp;field within a SOAP .NET web service created by a colleague (setup in the form as a Web Service data connection),&amp;nbsp;and validate that value according to rules within that web service.&amp;nbsp; (We are using the .NET ws for validation because validation of the same shared Sharepoint fields is done in a number of other places and we need to create a similar user experience throughout the application we are building.&amp;nbsp; We are also using a number of Sharepoint Managed Metadata fields and validating them isn&amp;#39;t easily done in Infopath).&amp;nbsp; At this point in the process, I am having trouble figuring out how to format&amp;nbsp;the XPathNavigator values so I can pass the values from the form to the WebService.&lt;/p&gt;&lt;p&gt;Here is the code I am currently using:&lt;/p&gt;&lt;p&gt;Public Function CallValidationService() As Boolean&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; Dim wsConnection As WebServiceConnection = DirectCast(Me.DataConnections(&amp;quot;Validate&amp;quot;), WebServiceConnection)&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; Dim formNavigator As XPathNavigator = MainDataSource.CreateNavigator()&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; Dim wsNavigator As XPathNavigator = Me.DataSources(&amp;quot;Validate&amp;quot;).CreateNavigator()&lt;/p&gt;&lt;p&gt;&lt;em&gt;&amp;#39;this line is where the value entered in the form is captured.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xformNav As XPathNavigator = formNavigator.SelectSingleNode(&amp;quot;/pr:properties/p:properties/documentManagement/ns3:ProjectName&amp;quot;, NamespaceManager)&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; MessageBox.Show(&amp;quot;Value of xFormNav&amp;quot; &amp;amp; xformNav.OuterXml.ToString())&lt;/p&gt;&lt;p&gt;&lt;em&gt;&amp;#39;this line is where the form value is being passed to the field in the data connection for the web service&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wsNavigator.SelectSingleNode(&amp;quot;/dfs:myFields/dfs:queryFields/ns7:Validate/ns7:projectName&amp;quot;, NamespaceManager).SetTypedValue(xformNav)&lt;/p&gt;&lt;p&gt;&lt;em&gt;&amp;#39;this line&amp;nbsp;passes the&amp;nbsp;data connection&amp;#39;s field value to the actual web service (we never get to this line)&lt;/em&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wsConnection.Execute()&lt;br /&gt;End Function&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As it stands now, when I debug this code, I get this error:&amp;nbsp; The method or operation is not implemented.&amp;nbsp; &lt;/p&gt;&lt;p&gt;The value of the MessageBox (containing the OuterXml of sformNav looks like this:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Value of xFormNav&amp;lt;ns3:ProjectName xmlns:ns3=&amp;quot;c4fbbb.....&amp;gt;entered project name &amp;lt;/ns3:ProjectName&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;where &amp;quot;entered project name&amp;quot; is the value I entered into the form.&lt;/p&gt;&lt;p&gt;I tried to create string values from the XPathNavigator objects (using both .ToString and .Value but always got this error:&lt;font size="3" face="Times New Roman"&gt;

&lt;/font&gt;&lt;/p&gt;&lt;p style="margin:0in 0in 0pt 0.5in;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;System.Net.WebException&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin:0in 0in 0pt 0.5in;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;The query cannot be run for the
following DataObject: Validate&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin:0in 0in 0pt 0.5in;" class="MsoNormal"&gt;&lt;font size="3" face="Times New Roman"&gt;

&lt;/font&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;InfoPath cannot run the specified
query.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin:0in 0in 0pt 0.5in;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;The SOAP response indicates that an
error occurred&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin:0in 0in 0pt 0.5in;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Input string was not in a correct
format.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin:0in 0in 0pt 0.5in;" class="MsoNormal"&gt;&lt;font size="3" face="Times New Roman"&gt;

&lt;/font&gt;&lt;/p&gt;&lt;p&gt;So my question is how do I manipulate what&amp;#39;s in the&amp;nbsp;XPathNavigator object and create something that I&amp;nbsp; can pass into the webservice using the wsConnection.Execute() line?&amp;nbsp; I hope I have explained things clearly enough but please let me know if you need more information.&amp;nbsp; Thanks in advance for any help you can give me.&amp;nbsp; Carol&lt;/p&gt;</description></item></channel></rss>