Awai, delivery guy

1 hour for cheese, 1 hour for supreme. What the heck?

  Home  |   Contact  |   Syndication    |   Login
  5 Posts | 0 Stories | 5 Comments | 6 Trackbacks

News

Archives

Post Categories

Biztalk Weblogs

Having just gone through this, I thought I'd share the basic procedure when calling WSS 3.0 Web services such as lists.asmx and views.asmx from a WCF client.  As you may know, the exceptions returned by the WSS Web services are terse.  Hopefully, this post will help someone trying to avoid those in their own project.

Step 1 - Add a Service Reference to the WCF service you want to call (Duh)

Note that I included the "?wsdl".  If you don't VS will be redirected to /_vti_bin/Lists.asmx.  That doesn't matter from a service client code generation standpoint, just that the WCF endpoint addresses in App.config will need to be changed as they'll be pointing to the wrong URL, and none of the lists and other objects in your site will be found by the Web services.   

Step 2 - Modify the App.Config file to change the security binding configuration used by the client

In the basicHttpBinding section, replace:

<security mode="None">
    <transport clientCredentialType="None"
               proxyCredentialType="None" realm="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
</security>

With:

<security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm" />
</security>

Step 3 - Allow the Web service to impersonate the user

WssList.ListsSoapClient listService = new WssList.ListsSoapClient("ListsSoap");
listService.ClientCredentials.Windows.AllowedImpersonationLevel
    = System.Security.Principal.TokenImpersonationLevel.Delegation;

XmlElement elem = listService.GetListCollection();

 

End transmission...

posted on Friday, July 06, 2007 9:47 AM

Feedback

# re: Calling WSS 3.0 Web Services from WCF clients 7/11/2007 8:39 PM Ashkan
You can also configure the allowed impersonation level using the configuration file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="NtlmEndpointBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<services />
<bindings>
<basicHttpBinding>
<binding name="ListsSoap">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://yourserver/_vti_bin/Lists.asmx"
behaviorConfiguration="NtlmEndpointBehavior" binding="basicHttpBinding"
bindingConfiguration="ListsSoap" contract="ListsSoap"
name="ListsSoap" />
</client>
</system.serviceModel>
</configuration>

# re: Calling WSS 3.0 Web Services from WCF clients 7/30/2007 9:00 PM Michael Awai
Thanks for the tip Ashkan

Post Feedback

Title:
Name:
Email: (never displayed)
Url:
Comments: