【发布时间】:2014-05-03 18:26:26
【问题描述】:
我在 Visual Studio 中从第三方 WSDL 添加服务引用,但它没有创建代理类,只是一个具有空命名空间的文件:
WSDL 地址是http://wwwh.cnj.jus.br/sgt/sgt_ws.php?wsdl
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18052
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MyApp.MyServiceReference {
}
我该如何解决?
更新:
我运行了命令
SvcUtil.exe /t:code "http://wwwh.cnj.jus.br/sgt/sgt_ws.php?wsdl" /d:D:\test
并得到以下错误:
错误:无法导入 wsdl:portType 详细信息:引发异常 在运行 WSDL 导入扩展时: System.ServiceModel.Description.XmlSerializerMessageContractImporter 错误:引用类型 'http://schemas.xmlsoap.org/soap/encoding/:Array' 仅适用于 编码的 SOAP。错误源的 XPath: //wsdl:definitions[@targetNamespace='http://wwwh.cnj.jus.br/sgt/sgt_ws.php']/wsdl:portType[@name='sgt_ws_methodsPort']
错误:无法导入 wsdl:binding 详细信息:导入时出错 wsdl:binding 所依赖的 wsdl:portType。 XPath 到 wsdl:端口类型: //wsdl:definitions[@targetNamespace='http://wwwh.cnj.jus.br/sgt/sgt_ws.php']/wsdl:portType[@name='sgt_ws_methodsPort'] 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://wwwh.cnj.jus.br/sgt/sgt_ws.php']/wsdl:binding[@name='sgt_ws_methodsBinding']
错误:无法导入 wsdl:port 详细信息:导入一个错误 wsdl:port 所依赖的 wsdl:binding。 XPath 到 wsdl:绑定: //wsdl:definitions[@targetNamespace='http://wwwh.cnj.jus.br/sgt/sgt_ws.php']/wsdl:binding[@name='sgt_ws_methodsBinding'] 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://wwwh.cnj.jus.br/sgt/sgt_ws.php']/wsdl:service[@name='sgt_ws_methodsService']/wsdl:port[@name='sgt_ws_methodsPort']
警告:未生成任何代码。如果您试图生成一个 客户端,这可能是因为元数据文档不包含 任何有效的合同或服务,或因为所有合同/服务 发现存在于 /reference 程序集中。验证您是否通过了 该工具的所有元数据文档。
警告:如果您想从模式生成数据协定 确保使用 /dataContractOnly 选项。
【问题讨论】:
标签: c# .net web-services wcf wsdl