Monday, April 21, 2008

Security issue when calling a WCF service from SharePoint

I've recently been charged with integrating several WCF services into SharePoint and it's been relatively smooth sailing up until I began to receive the following exception:

"The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate......."

My endpoint configuration originally looked like so:


<endpoint address="http://myserver/Services/BackOfficeService/basic"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBackOfficeService"
contract="BackOfficeService.IBackOfficeService" name="BasicHttpBinding_IBackOfficeService" />

Looks ok, right?

Wrong! We are missing the 'identity' child of the endpoint element. So, to correct this issue, the final product should look like this:

<endpoint address="http://myserver/Services/BackOfficeService/basic"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBackOfficeService"
contract="BackOfficeService.IBackOfficeService" name="BasicHttpBinding_IBackOfficeService">
<identity>
<userPrincipalName value="service@company.com" />
</identity>
</endpoint>

HTH,

Grant

2 comments:

Anonymous said...

what happen when myserver is an unicode computer name, say Japanese?, it won't work anymore

Steve Hayes said...

Hello!

I am being charged with the same task and was hoping maybe you could provide me with some steps or an example project? Anything would be greatly appreciated.