Search code examples
web-servicesf#wsdltype-providers

F# Type Provider for WSDL and BasicHttpBinding


When I use a WSDL service in C# I am able to pass two parameters to the constructor; BasicHttpBinding and EndpointAddress

BasicHttpBinding basicHttpBinding = new BasicHttpBinding { MaxReceivedMessageSize = 20000000, MaxBufferSize = 20000000 };
EndpointAddress endpointAddress = new EndpointAddress(delarsListUrl);
var ds = new DealersService.DealersServiceClient(basicHttpBinding,endpointAddress);

When I use the WSDL Type provider in F# I am only allowed to call the constructor without any parameters or with one parameter of type BasicHttpBinding. So how do I set the parameters like MaxReceivedMessageSize or MaxBufferSize?

EDIT:

If I put this to the app.config of the Azure Worker role

<system.serviceModel>
   <bindings>
     <basicHttpBinding>
       <binding name="basicHttp" allowCookies="true"
             maxReceivedMessageSize="20000000"
             maxBufferSize="20000000"
             maxBufferPoolSize="20000000">
         <readerQuotas maxDepth="32"
           maxArrayLength="200000000"
           maxStringContentLength="200000000"/>
       </binding>
     </basicHttpBinding>
   </bindings>
 </system.serviceModel>

It does not help, I still get an exception that maxReceivedMessageSize is only 64k and I should change it. I had the same problem in C#, the app.config setting seemed to be ignored so I solved it by passing an BasicHttpBinding with these settings to the constructor.


Solution

  • simplified data context (that is created via T.GetDataContext()) exposes only parameterless constructor and constructor that accepts EndpointAddress. If you want to setup bindings manually - you can instantiate client class directly (it should be located inside ServiceTypes) i.e.:

    type WSDL = Microsoft.FSharp.Data.TypeProviders.WsdlService< @"http://www.webservicex.net/RealTimeMarketData.asmx?WSDL">
    let client = new WSDL.ServiceTypes.RealTimeMarketDataSoapClient(...)