Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# The provided URI scheme 'http' is invalid; expected 'https'

Tags:

c#

uri

app-config

I am getting this error while invoking a method of my web service, I dont know what to do anymore :s

Here is the exception details:

{"The provided URI scheme 'http' is invalid; expected 'https'.\r\nParameter name: via"}

Here is my App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

    <connectionStrings>
      <add name="PowerWeb" connectionString="Data Source=MYSERVER;Initial Catalog=MYTABLE;User ID=MYUSER;Password=MYPW" providerName="System.Data.SqlClient" />
    </connectionStrings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>



      <bindings>
        <customBinding>
          <binding name="ZWS_HARMONIZACAO">
            <!--    WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:sap-com:document:sap:rfc:functions':    -->
            <!--    <wsdl:binding name='ZWS_HARMONIZACAO'>    -->
            <!--        <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/">..</saptrnbnd:OptimizedXMLTransfer>    -->
            <!--        <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/">..</saptrnbnd:OptimizedXMLTransfer>    -->
            <!--        <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">..</sapattahnd:Enabled>    -->
            <textMessageEncoding messageVersion="Soap11" />

            <httpsTransport authenticationScheme="Basic"  />


          </binding>
        </customBinding>
      </bindings>
        <client>
            <endpoint address="http://mydomain:8080/sap/bc/srt/rfc/sap/zws_harmonizacao/010/zws_harmonizacao/zws_harmonizacao"
                binding="customBinding" bindingConfiguration="ZWS_HARMONIZACAO"
                contract="ServiceReference1.ZWS_HARMONIZACAO" name="ZWS_HARMONIZACAO" />
        </client>

    </system.serviceModel>
</configuration>

Can anyone help me? Thanks a lot in advance

like image 383
TiagoM Avatar asked Feb 14 '14 12:02

TiagoM


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr. Stroustroupe.

Is C programming hard?

C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.


2 Answers

You are specifying an httpsTransport in the binding, but in the endpoint definition you are providing http as a protocol. As suggested in the comment, try changing the <endpoint address="http://... to https

like image 72
Honza Brestan Avatar answered Sep 18 '22 09:09

Honza Brestan


I have changed the configuration of the binding like this:

 var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
 var address = new EndpointAddress(url);
 var client = new MobileServiceClient.MobileServiceClient(binding, address);

The endpoint address is like:

http://server101.local/MobileService.svc

And it works.

like image 35
DanielV Avatar answered Sep 18 '22 09:09

DanielV