使用F#WsdlService类型提供编译错误 [英] Compile error using F# WsdlService type provider

查看:286
本文介绍了使用F#WsdlService类型提供编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在F#的类型提供。我已经使用WsdlService提供商,在下列方式取得了一些成功:

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

键入EC2 = WsdlService<http://s3.amazonaws.com/ec2-downloads/ec2.wsdl>

但是当我下载一个WSDL,其重命名为.wsdlschema并根据这个例子中规定的方法提供它作为一个本地模式

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中发出的错误信息:

Visual Studio emits an error message:

该类型的提供   Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders   报告错误:错误:未指定有效输入文件。指定   无论是元数据文件或汇编文件

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

此消息的错误,因为文件一清二楚是有效的,因为previous例子证明了。

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

我已经考虑权限问题,我已经多次从我的用户文件夹相同的例子,并确保完全控制授予所有用户在这两种情况下,以及运行VS以管理员身份。

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.

为什么F#编译器认为该文件是无效的?

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

编辑#1:我已经证实,做同样的事情不适合的http://gis1.usgs.gov/arcgis/services/gap/GAP_Land_Cover_NVC_Class_Landuse/MapServer?wsdl无论是(美国地质调查局的植被相关API),而引用的WSDL网上正常工作。

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.

推荐答案

嗯,看来该类型提供相当固执,不灵活的,它需要一个真正的wsdlschema文档时,使用 LocalSchemaFile 选项。一个wsdlschema文件可以包含多个的.wsdl和xsd文件在其中,以XML格式,让他们分开。我猜这是在微软的工具链某种标准的东西,但也许其他人(如亚马逊)不公开这样的东西。

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.

在TP试图做的第一件事是打开包装wsdlschema文件到其独立的部分,而可悲的是它做错误的事情,如果实际上没有拆包工作要做。然后,当它试图指向svcutil.exe的在解压缩模式文件做codeGEN,这个死与您所看到的错误消息。

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.

解决方法:添加XML的预期位到您的文件,它会工作

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>

这篇关于使用F#WsdlService类型提供编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆