Search code examples
.netweb-servicesvisual-studio-2008sap-crm

Configuration of webservice client


I've created proxy classes using svcutil with a given "SAP CRM" WSDL file. It worked great and it generated a output.cs.

So added this output.cs in my visual studio project und created a simple test application. The test application can be compiled and even run, but I don't know why. I didn't enter any service URL.

How can this be and how can I configure the test application to use the proper SAP URL?

Thanks

it's a follow up question to this Problem creating proxy class with wsdl.exe


Solution

  • You'll have following constructors in your generated proxy:

     public SampleServiceClient(string endpointConfigurationName)
            :
                base(endpointConfigurationName)
        {
        }
    
    public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress)
        :
            base(binding, remoteAddress)
        {
        }
    

    The first one references endpoint description in your config file, the other accepts programmatically created binding and endpoint address.

    As for username/password part, with your binding properly configured, use the proxy.ClientCredentials.UserName property.