Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2005

Tip: Looking for answers? Try searching our database.

webservice for infopath that can use query fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Depova - 06 Nov 2005 00:32 GMT
I've been working with webservices for a few weeks now and am having
trouble.  I've been able to make a web service that will submit to a
sql 2000 database and query from it.  Problem is the only query I've
been able to make work returns all results.  What I'd like to be able
to do is use query fields in the infopath form.  I'm using visual
studio.net 2003 and this walkthrough from microsoft to make the
webservice.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ip2003_tr/h
tml/odc_INF_Lab_09.asp


Can someone post code to a sample web service that has this capability
with maybe some instructions, or at least point me someplace where they
show this?

Thanks in advance.
bratt - 09 Nov 2005 15:52 GMT
Here is some code from my VB app - which could be easily transferred to
c# if needed - basically you add a parameter in the web service that
filters your dataset then from InfoPath you specify the parameter in
the XML that gets sent to the service. The biggest problem is making
sure the names spaces and Xpath's are correct. This code calls my web
service for getting a unique ID.

' dataconnection to my webservice is called: UniqueID
Private Function GetNextUniqueID(Optional ByVal KeyName As String =
"InfopathApp") As String
Try
Dim UniqueID As DataObject = thisXDocument.DataObjects("UniqueID")
Dim domtemplate As IXMLDOMDocument3 = UniqueID.DOM

'Set the SelectionNamespaces so that you can find the correct field
domtemplate.setProperty("SelectionNamespaces", _

"xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"""
& _
           "
xmlns:d=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"""
& _
           "
xmlns:dsf=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"""
& _
           " xmlns:ns3=""UniqueIDURI""")

'Set Web Service parameters
domtemplate.selectSingleNode("/dfs:myFields/dfs:queryFields/ns3:UniqueID/ns3:applicationName").text
= KeyName

UniqueID.Query()

' get value from: UniqueIDResponse/UniqueIDResult
Return
domtemplate.selectSingleNode("//dfs:dataFields//UniqueIDResponse//UniqueIDResult").text
Catch ex As Exception
' unique connection is not running - create one and HOPE you are unique
Dim today As Date = Now()
Return today.ToString("yyyyMMddhhmmss")
End Try

in my UniqueID webservice I have an input parameter to filter the
dataset:
<WebMethod()> _
Public Function UniqueID(ByVal ApplicationName As String) As String
'' if you are opening a recordset directly with a sql clause you may
want to check for sql injections:
'' ApplicationName = ApplicationName.Replace("'","''")
'' ...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.