Consuming Sharepoint Web Services in InfoPath form

M

Makor

Could someone possibly explain how we need to go about consuming the web
services provided by Sharepoint in a InfoPath form?

We follow the following pocess:
1. Add a new data connection
2. Select web sservice (recive data)
3. Add web service location: (for example
http://server/_vti_bin/UserGroup.asmx or http://server/_vti_bin/Lists.asmx)

Then we try and associate this connection to a drop down list box control
and we we cannot seem to get past the repeating group assignment when linking
the control to the data connection - since none of the web services return a
repeating recordset.

Does anyone have some ideas regarding consuming the Sharepoint web services
- specifically the Usergroup and Lists ones?
 
E

Ed Richard

makor, are you looking for Lists, or do you actually want the list items?

In the first case you can attach SP-Web Services by adding a listbox to the
form open the properties for the listbox, go to Listbox entries, choose
Lookup values from Web Service... click Add and go through the whole process
of the wizard. you might have to supply the proper XML as parameters values
for some of the methods. You should be able to find examples of the
parameters in the WSS-SDK on MSDN.

The second case, is a matter of choosing Sharepoint Library or List after
hiting the Add button.

HTH,
Ed Richard
 
M

Matthew Blain \(Serriform\)

Unfortunately, the SharePoint web services can be difficult to work with in
InfoPath due to some of the issues you mention, primarily because the WSDL
doesn't describe the schema of the data. There are a number of ways to make
this work, check out chapter 7 of the book mentioned below. You basically
trick InfoPath into understanding the schema.

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com/
 
M

Makor

Mathew

I appreciate the info however, you do not have any examples of how to
interface Infopath with sharepoint in Chapter 7 - and so although I
understand the mechanism of what you are saying, I would really appreciate
some assistance in maybe seeing a sample form that you have achieved
integration with a Sharepoint list would REALLY be helpful. I am struggling
to find any documentation on this and if you have it figured out - I would
really benefit from seeing how you did ut.

Thank you.
 
M

Matthew Blain \(Serriform\)

Ah, you're right, that section is not as clear as I would have liked it to
be... Take a look at "Web Services that Return XML in a String" (pg 222)
(right after 'web services that return untyped XML, which is the scenario
you're dealing with there).

Instead of going through the hoops of turning a string into XML, you already
have XML, but InfoPath doesn't understand the schema. So you can take the
returned XML (I tend to use Web Service Studio (
http://www.gotdotnet.com/team/tools/web_svc/default.aspx ) to get the XML
from web services, though you can also use some code or other mechanism to
display the XML as text) and use that to generate the proper schema, for
example using InfoPath (add the XML file as a secondary data source just
like in steps 18 and on). Then instead of using the XmlStringToData
function, you can just copy the entire result nodes from one datasource (the
untyped info from the web service) into the other (the one which InfoPath
understands). (You can use node.clone(true) and node.insertAfter).

Two other options are to take the schema which InfoPath generated for the
web service plus the schema it generated for the results, and merge them by
hand--this is more complex but a little more performant at runtime. Or you
can use code (e.g. .NET Web References) to do this. For the lists web
service, I always use code, though it happens to be in jscript since I wrote
it before there was .NET support in InfoPath.

I hope this makes things more clear, this is a complex topic, as it involves
the interaction between web services, schema, infopath autogenerated
schemas, and infopath data connections. There are some more examples of
using the lists web service at the end of chapter 9, but I believe we ran
out of time to get any more SharePoint web service examples in the book.

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top