Implement public wcf service in SharePoint
By Anatoly Mironov
If you have an external web service reference in your sharepoint solution, you can use web.config configuration like:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding\_ISuperService" >
<security mode="None">
<message clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://super.domain/SuperService.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding\_ISuperService"
contract="ISuperService"
name="SuperServiceEndpoint">
</endpoint>
</client>
</system.serviceModel>
```security mode is set to "None". Then in code just get this configuration:
var proxy = new SuperServiceClient(“SuperServiceEndpoint”); var result = proxy.GetSomething();
var binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.None; var endpoint = new EndpointAddress(“http://super.domain/SuperService.svc"); var proxy = new ExternalServices.DreamServiceClient(binding, endpoint); var result = proxy.GetSomething();