UserGroup.asmx web service GetUsersFromGroupCellection

R

Reyzor

I have a Site Group that i have named "Developers". The form I'm creating is
to allow a project manager to assign resources. I need to have a drop down
list be populated by a call to the UserGroup.asmx web service
GetUsersFromGroupCollection web method. Is there any way to accomplish this
using the out of the box "Secondary Data Sources" and passing the roleName
"Developers" to the web service?

If not, is it correct that the only 2 options are as follows:

1) Use script and the soap 3.0 toolkit to programatically call the web
service (but this requres all clients that use the form to have 3.0 installed)

2) Write a .net managed assembly to handle business logic for the form
 
S

ScottD[Interlink Group]

You can use a secondary data source to call the web service to retrieve the
data. To pass the 'Developers' value to the web service you can set a
default value for the query field in the data source to 'Developers'.
 
R

Reyzor

Scott, sorry, I should have been more specific. What I meant to say was, it
is IMPOSSIBLE to use the GetUserCollectionFromGroup web method of the
http://<servername>/sites/<sitename>/_vti_bin/UserGroup.asmx web service. It
does not return data whose schema is understood by infopath.

Is there a hack you know of. If not, I can not think of any other option
than the 2 below:
1) Use script and the soap 3.0 toolkit to programatically call the web
service (but this requres all clients that use the form to have 3.0
installed) and ensure that we programatically set the option values in the
dropdown

2) Write a .net managed assembly to handle business logic for the form
 
G

Greg Belenky

2) Write a .net managed assembly to handle business logic for the form

3) Build your own "proxy" webservice for quering sharepoint web service that
returns data in format that infopath can understand. It's much simpler than
calling sharepoint web service from form's managed code...

Benefits:
- simple code for your webservice - it's just a proxy.
- simple using in infopath form - you jus add it like webservice connection.

Sharepoint webservices accept as parameters xml nodes with queries, options
and so on... i can't found how I can set that cind of parameters in
infopath. so I've developed described solution (for sharepoint Lists.asmx).
it works.
 
R

Reyzor

I was referring to a "proxy" .net web service in #2, so you have validated my
thoughts. I'm going with the proxy...

FYI, for anyone who might need a reference, great article from MSDN on this:

Using a .NET Proxy Service to Connect to a Web Service

If you don't have control over the RPC/encoded Web service you want to work
with, you can create a document/literal proxy Microsoft .NET Web service that
provides wrapper functions for each of the Web methods you want to invoke
from the RPC/encoded Web service. You can then work with the proxy
document/literal Web service from InfoPath.

..NET Framework code is able to work with any type of Web service (both
RPC/encoded and document/literal), and all .NET Web services use the
document/literal style and encoding. Because the .NET Framework can
communicate with any kind of Web service, you can create a .NET Web service
with methods that make calls to the RPC/encoded Web service. The .NET Web
service will act as a translator that enables InfoPath to make
document/literal style calls to the .NET Web service which in turn can make
RPC/encoded style calls to the original Web service.

The prerequisites for creating such a proxy Microsoft .NET Web service are a
Microsoft Windows XP Professional, Microsoft Windows 2000 Server, or
Microsoft Windows Server 2003 running Microsoft Internet Information Services
(IIS) with ASP.NET installed on which to deploy the proxy Web service. When
you create an InfoPath solution, you will point to the proxy Web service
instead of the RPC/encoded Web service. The proxy Web service will then make
calls to the RPC/encoded service.
Creating a Proxy Web Service Using Visual Studio .NET

The following procedure describes how to create a proxy Microsoft .NET Web
service from Microsoft Visual Studio .NET.

1. Create a new ASP.NET Web Service project.
2. In the Solution Explorer, right-click the References folder of your
new project, and then click Add Web Reference.
3. In the Add Web Reference dialog box, type in the URL of the
RPC/encoded Web service you want to work with, and then click Go.
4. Click Add Reference.
5. Open the .asmx file for your Web service and add one Web method to
call each Web method from the referenced RPC/encoded Web service.
6. To view a list of the methods in the reference RPC/encoded Web server,
display the Class View window. For each Web method you will see three
methods. For example, if the Web method is called doSearch, then you will see
three methods called doSearch, BegindoSearch, and EnddoSearch. You only need
to create a wrapper Web method for the doSearch method. Be sure to match the
exact method signature and return type.
7. Within each wrapper method, you need to write code to make a call to
the referenced RPC/encoded Web service as shown in the following example.

[WebMethod]
public string[] doSearch(string keyword)
{
SearchService srch = new SearchService();
return srch.doSearch(keyword);
}

8. If the RPC/encoded Web service requires authentication, you can hard
code the credentials required to connect to the RPC/encoded Web service into
the source code for the proxy .NET Web service, or you can use code like the
following example.

myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;

For more information, search for the "HOW TO: Pass Current Credentials
to an ASP.NET Web Service" Microsoft Knowledge Base article on
http://support.microsoft.com/.

Creating a Proxy Web Service Without Visual Studio .NET

Alternatively, you can create a proxy Web service by using the tools that
are provided with the .NET Framework Software Development Kit, which can be
downloaded from MSDN.

Use the Web Services Description Language Tool (Wsdl.exe) to create the code
file for your proxy Web service. This code file can be compiled by using the
C# command-line compiler (csc.exe) or the Visual Basic .NET command-line
compiler (vbc.exe), which are also included with the .NET Framework SDK.
After the Web Services Description Language tool has generated the code file,
rename the file extension to .asmx and open the file in any text editor. On
the very first line of the document, add the following page directive:

<%@ WebService Language="C#" class="GoogleSearchServiceWrapper" %>

Go to the end of the code file and create a call to each Web method in the
RPC/encoded Web service. The following code sample shows the code for a .NET
Web service that connects to the Google Web service, which uses the
RPC/encoded style of development. There is a placeholder for where the
wsdl.exe generated code should go.

The following code sample shows the code for a .NET Web service that
connects to the Google Web service, which uses the RPC/encoded style of
development.

<%@ WebService Language="C#" class="GoogleSearchServiceWrapper" %>

using System;
using System.Web.Services;

// The auto-generated code from the wsdl.exe tool goes here.

[WebService]
public class GoogleSearchServiceWrapper : System.Web.Services.WebService
{
[WebMethod]
public System.Byte[] doGetCachedPage(System.String key, System.String url)
{
GoogleSearchService srch = new GoogleSearchService();
return srch.doGetCachedPage(key, url);
}

[WebMethod]
public System.String doSpellingSuggestion(System.String key,
System.String phrase)
{
GoogleSearchService srch = new GoogleSearchService();
return srch.doSpellingSuggestion(key, phrase);
}

[WebMethod]
public GoogleSearchResult doGoogleSearch(
System.String key,
System.String q,
System.Int32 start,
System.Int32 maxResults,
System.Boolean filter,
System.String restrict,
System.Boolean safeSearch,
System.String lr,
System.String ie,
System.String oe)
{
GoogleSearchService srch = new GoogleSearchService();
return srch.doGoogleSearch(key, q, start, maxResults,
filter, restrict,
safeSearch, lr, ie, oe);
}
}
 

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