none
difference between wsdl and svcutil

    Question

  • i have a strange issue.

    i received a wsdl file, i need to make a client to call the methods in this webservice. this call requires ssl with certificate plus authentication

    when i generated the proxy class with wsdl.exe i can call the webservice method by overriding the GetWebRequest() method of SoapHttpClientProtocol class.

    but when i generate the proxy class with svcutil, and initiate the client, set the username/password for it

    proxy.ClientCredentials.UserName.UserName = username;
    proxy.ClientCredentials.UserName.Password = password;
    

    i receive always Authentication Required response from the web service.

    i would appreciate any help what can i do, i spent already so many hours on this subject without success.

     


    Ivan
    Wednesday, April 06, 2011 4:58 PM

Answers

All replies

  • In WCF you also need to configure the binding.

    The exact config depends if you need message or transport level security. Probably basicHttpBinding with one of the above should work.

     


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Thursday, April 07, 2011 2:29 AM
  • thanks for the reply

    this is the config file created by svcutil.exe

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="HelloWorld_Request_Binding" closeTimeout="00:01:00"
              openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
              allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
              messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
              useDefaultWebProxy="true">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <security mode="Transport">
                <transport clientCredentialType="None" proxyCredentialType="None"
                  realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        <client>
          <endpoint address="https://URL"
            binding="basicHttpBinding" bindingConfiguration="HelloWorld_Request_Binding"
            contract="GeneratedProxyClasses.HelloWorld.HelloWorld_Request_PortType"
            name="HelloWorld-Port" />
        </client>
      </system.serviceModel>
    </configuration>
    

    but with these configuration settings i'm not able to consume the HelloWorld web service.

    in the request header (in fiddler) the username/password are available, but may be not as Authentication header.

    do you have an idea how can i implement an authentication header? 


    Ivan
    Thursday, April 07, 2011 5:50 AM
  • use fuddler to inspect a working request. if it uses http headers then change transport/clientCredentialType to a different value.
    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    • Marked as answer by Yi-Lun Luo Wednesday, April 13, 2011 9:06 AM
    Friday, April 08, 2011 2:09 AM