0

I want to connect to SharePont through SOAP and Claims authentification. When I try my code I got the message:

URI scheme 'http' give is not valid ; Scheme 'https' was expected.

App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
      <bindings>
           <basicHttpBinding>
              <binding name="ListsSoap">
                <security mode="Transport">
                  <transport clientCredentialType="Ntlm" />
                </security>
              </binding>
            </basicHttpBinding>
        </bindings>
        <client>

          <endpoint address="http://mysharepointAdress/_vti_bin/Lists.asmx"
              binding="basicHttpBinding" bindingConfiguration="ListsSoap"
              contract="ListService.ListsSoap" name="ListsSoap"/>
        </client>

      </system.serviceModel>
</configuration>

Code:

       const string listName = "myList";

        var query = new XElement("Query", "");
        var viewFields = new XElement("ViewFields", "");
        var queryOptions = new XElement("QueryOptions", "");

        var client = new ListService.ListsSoapClient();
        //client.ChannelFactory.Credentials.HttpDigest.ClientCredential = new System.Net.NetworkCredential("appes", "PWD");
        var result = client.GetListItems(listName, null, query, viewFields, null, queryOptions, null);
        Console.WriteLine(result);

How can I use http instead of https to get data from my site ?

Edit: Just for informations. I didn't know why I can't use http with SOAP, so I use the Rest API. It work very well !

0

I would strongly suggest that you use https for authentication using oauth on a live system. However if it is a development machine, you can configure it to use http.

You have to update the settings of the security token service (STS). The powershell script below should help you do that.

$c = Get-SPSecurityTokenServiceConfig

$c.AllowMetadataOverHttp = $true

$c.AllowOAuthOverHttp= $true

$c.Update()

I would also suggest you read the following article:

http://blogs.technet.com/b/speschka/archive/2012/07/23/setting-up-an-oauth-trust-between-farms-in-sharepoint-2013.aspx

  • In the production farm i can use https but not in the dev farm. I don't need to communicate between two farms, should i follow the article anyway ? I try the powershell snippet but i have the same error when i try my code. – Sancho May 30 '14 at 13:31
  • @Sancho Yes. Please run the powershell script. You still need to configure the STS to allow authentication and metadata over http. – Sabrish Ayyappan Balachander May 30 '14 at 13:35
  • Already run but didn't change anything – Sancho May 30 '14 at 13:38
  • @Sancho you might have to do an IISReset. – Sabrish Ayyappan Balachander May 30 '14 at 13:39
  • I restart iis with iisreset.exe, service manager and i try with a server reboot. But still have the error message. – Sancho May 30 '14 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.