我在VS2012的add service reference中添加一个wsdl进去,可以找到服务,但namespace没有生成类。
于是用wsdl.exe试试生成,执行下面命令:
但结果返回error,不知道什么原因?和该wsdl自身格式有没有关系? 谢谢!
1 个解决方案
#1
如下,使用svcutil.exe指令 svcutil.exe [/n:] /out:
D:\>svcutil /n:http://eric.org,eric.org http://127.0.0.1:8988/calculatorservice/
metadata /out:d:\client.cs
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://127.0.0.1:8988/calculatorservice/me
tadata' using WS-Metadata Exchange or DISCO.
Generating files...
d:\client.cs
D:\output.config
+++++++++++++++指令解释++++++++++++++++++++++++++++++++++++
1) /n
/namespace: - A mapping from a WSDL or XML Schema targetNamespace to a CLR namespace. Using the '*' for the targetNamespace maps all targetNamespaces without an explicit mapping to that CLR namespace. Default: derived from the target namespace of the schema document for Data Contracts. The default namespace is used for all other generated types. (Short Form: /n)
2) url
读取WSDL服务定义的链接
3)/out:
输出文件的路径文件名。
D:\>svcutil /n:http://eric.org,eric.org http://127.0.0.1:8988/calculatorservice/
metadata /out:d:\client.cs
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://127.0.0.1:8988/calculatorservice/me
tadata' using WS-Metadata Exchange or DISCO.
Generating files...
d:\client.cs
D:\output.config
+++++++++++++++指令解释++++++++++++++++++++++++++++++++++++
1) /n
/namespace: - A mapping from a WSDL or XML Schema targetNamespace to a CLR namespace. Using the '*' for the targetNamespace maps all targetNamespaces without an explicit mapping to that CLR namespace. Default: derived from the target namespace of the schema document for Data Contracts. The default namespace is used for all other generated types. (Short Form: /n)
2) url
读取WSDL服务定义的链接
3)/out:
输出文件的路径文件名。
#1
如下,使用svcutil.exe指令 svcutil.exe [/n:] /out:
D:\>svcutil /n:http://eric.org,eric.org http://127.0.0.1:8988/calculatorservice/
metadata /out:d:\client.cs
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://127.0.0.1:8988/calculatorservice/me
tadata' using WS-Metadata Exchange or DISCO.
Generating files...
d:\client.cs
D:\output.config
+++++++++++++++指令解释++++++++++++++++++++++++++++++++++++
1) /n
/namespace: - A mapping from a WSDL or XML Schema targetNamespace to a CLR namespace. Using the '*' for the targetNamespace maps all targetNamespaces without an explicit mapping to that CLR namespace. Default: derived from the target namespace of the schema document for Data Contracts. The default namespace is used for all other generated types. (Short Form: /n)
2) url
读取WSDL服务定义的链接
3)/out:
输出文件的路径文件名。
D:\>svcutil /n:http://eric.org,eric.org http://127.0.0.1:8988/calculatorservice/
metadata /out:d:\client.cs
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://127.0.0.1:8988/calculatorservice/me
tadata' using WS-Metadata Exchange or DISCO.
Generating files...
d:\client.cs
D:\output.config
+++++++++++++++指令解释++++++++++++++++++++++++++++++++++++
1) /n
/namespace: - A mapping from a WSDL or XML Schema targetNamespace to a CLR namespace. Using the '*' for the targetNamespace maps all targetNamespaces without an explicit mapping to that CLR namespace. Default: derived from the target namespace of the schema document for Data Contracts. The default namespace is used for all other generated types. (Short Form: /n)
2) url
读取WSDL服务定义的链接
3)/out:
输出文件的路径文件名。