title: C# Configuring web socket bindings for ebay uploads to LMS
body: <p>Ok so I'm trying to get this working but can't seem to get it right.
  I need to create a web socket http binding for ebay LMS.</p>
  
  <p>This is my web config:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
  &lt;bindings&gt;
    &lt;wsHttpBinding&gt;
      &lt;binding name="BulkDataExchangeService" closeTimeout="00:01:00"
         openTimeout="00:01:00" receiveTimeout="00:10:00"
         sendTimeout="00:01:00" bypassProxyOnLocal="false"
         transactionFlow="false" hostNameComparisonMode="StrongWildcard"
         maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
         messageEncoding="Text" textEncoding="utf-8"
         useDefaultWebProxy="true" allowCookies="false"&gt;
        &lt;readerQuotas maxDepth="32" maxStringContentLength="8192"
            maxArrayLength="16384" maxBytesPerRead="4096"
            maxNameTableCharCount="2147483647" /&gt;
        &lt;reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" /&gt;
        &lt;security mode="Message"&gt;
          &lt;transport clientCredentialType="Windows"
              proxyCredentialType="None" realm="" /&gt;
          &lt;message clientCredentialType="Windows"
              negotiateServiceCredential="true" algorithmSuite="Default"
              establishSecurityContext="true" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;client&gt;
    &lt;endpoint address="https://webservices.sandbox.ebay.com/BulkDataExchangeService"
      binding="wsHttpBinding" bindingConfiguration="BulkDataExchangeService"
      contract="BulkDataExchangeServicePort" name="BulkDataExchangeService"&gt;
      &lt;identity&gt;
        &lt;userPrincipalName value="machine\user" /&gt;
      &lt;/identity&gt;
    &lt;/endpoint&gt;
  &lt;/client&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>This is my code to create the upload request:</p>
  
  <pre><code>private void CreateUploadJobEbay()
      {
          var ebayAuthTokenSetting = _settingService.GetSettingByKey(
                              "ebaysetting.authtoken", "");
  
          //EndpointAddress endpoint = new EndpointAddress("https://webservices.sandbox.ebay.com/BulkDataExchangeService");
  
          BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient("BulkDataExchangeService");
  
          using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
          {
              HttpRequestMessageProperty httpRequest = new HttpRequestMessageProperty();
  
              OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);
  
              //Add the request headers
              httpRequest.Headers.Add("X-EBAY-SOA-SECURITY-TOKEN", ebayAuthTokenSetting);
              httpRequest.Headers.Add("X-EBAY-SOA-SERVICE-NAME", "BulkDataExchangeService");
              httpRequest.Headers.Add("X-EBAY-SOA-SERVICE-VERSION", "1.0.0");
              httpRequest.Headers.Add("X-EBAY-SOA-MESSAGE-PROTOCOL", "SOAP12");
              httpRequest.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "createUploadJob");
  
              //Create the request
              CreateUploadJobRequest req = new CreateUploadJobRequest();
  
              //Supply additional parameters
  
              //The UUID must be unique. Once used, you can't use it again
  
              req.UUID = System.Guid.NewGuid().ToString();
  
              //Specify job type
  
              req.uploadJobType = "AddFixedPriceItem";
  
              req.fileType = FileType.XML;
  
              //Get the response
  
              CreateUploadJobResponse resp = client.createUploadJob(req);
  
              Debug.WriteLine("resp = " + resp);
          }
      }
  </code></pre>
  
  <p>The BulkDataExchangeService comes from <a href="https://ebaydts.com/eBayKBDetails?KBid=1335" rel="nofollow noreferrer">this link</a> Down near the bottom you will see BDXSmaple.zip which contains the code.</p>
  
  <p>The problem I'm having is with the service contract <code>contract="BulkDataExchangeServicePort"</code></p>
  
  <blockquote>
    <p>If I hover over the contract it gives me the error "The contract
    attribute is invalid - The value BulkDataExchangeServicePort is
    invalid according to it's data type clientContractType - The
    enumeration constraint failed"</p>
  </blockquote>
  
  <p>In the debug window I get this message:</p>
  
  <blockquote>
    <p>Exception thrown: 'System.InvalidOperationException' in
    System.ServiceModel.dll Could not find endpoint element with name
    'BulkDataExchangeService' and contract 'BulkDataExchangeServicePort'
    in the ServiceModel client configuration section. This might be
    because no configuration file was found for your application, or
    because no endpoint element matching this name could be found in the
    client element.</p>
  </blockquote>
  
  <p>I'm really not sure where I'm goign wrong with the service contract. can anyone help. Cheers</p>