Question

I'm trying out type providers in F#. I've had some success using the WsdlService provider in the following fashion:

type ec2 = WsdlService<"http://s3.amazonaws.com/ec2-downloads/ec2.wsdl">

but when I download that wsdl, rename it to .wsdlschema and supply it as a local schema according to the method specified in this example:

type ec2 = WsdlService< ServiceUri="N/A", ForceUpdate = false, 
                          LocalSchemaFile = """C:\ec2.wsdlschema""">

Visual Studio emits an error message:

The type provider 'Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders' reported an error: Error: No valid input files specified. Specify either metadata documents or assembly files

This message is wrong, since the file quite plainly is valid, as the previous example proves.

I've considered permissions issues, and I've repeated the same example from my user folder, making sure to grant full control to all users in both cases, as well as running VS as administrator.

Why does the F# compiler think the file isn't valid?

edit #1: I have confirmed that doing the same thing doesn't work for http://gis1.usgs.gov/arcgis/services/gap/GAP_Land_Cover_NVC_Class_Landuse/MapServer?wsdl either (a USGS vegetation-related API) whereas referencing the wsdl online works fine.

Was it helpful?

Solution

Hmmm, it appears that the type provider is rather stubborn and inflexible in that it requires a true "wsdlschema" doc when using the LocalSchemaFile option. A wsdlschema document can contain multiple .wsdl and .xsd files within it, wrapped in some XML to keep them separate. I'm guessing this is some kind of standard thing in the Microsoft toolchain, but perhaps others (e.g. Amazon) don't expose stuff like this.

The first thing the TP attempts to do is unpack the wsdlschema file into its separate parts, and sadly it does the wrong thing if in fact there is no unpacking to be done. Then, when it tries to point svcutil.exe at the unpacked schema files to do the codegen, this dies with the error message you are seeing.

Workaround: Add the expected bits of XML into your file, and it will work.

<?xml version="1.0" encoding="utf-8"?>
<ServiceMetadataFiles>
  <ServiceMetadataFile name="ec2.wsdl">

  [body of your WSDL goes here]

  </ServiceMetadataFile>
</ServiceMetadataFiles>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top